pan class="keyword">for</span>(j=1:s.nperiod/4)
  <span class="keyword">for</span> jj=1:size(totalFR,3)
    totalFR1(:,j,jj)=sum(totalFR(:,(j-1)*4+1:j*4,jj)');
  <span class="keyword">end</span>
<span class="keyword">end</span>
m.fr.FinReq(:,:,p)=totalFR1(:,:,1); <span class="comment">%distribution of simulated financial requirements by year</span>
<span class="keyword">switch</span> s.frFeedback
    <span class="keyword">case</span> <span class="string">'yes'</span>
        m.fr.Expenses(1,:,p)=mean(totalF