How do I create an iterated or recursive formula that includes the product of a sequence?
이전 댓글 표시
I am new to matlab, so I apologize if my code is quite poor, but that's why I'm here!
I'm attempting to create the recursive formula below (it is formatted for LaTeX, which I don't think renders on this site, but I have attached an image of it as well):
$k_{T+1}=(1-\delta)k_T+k_{T}^\alpha-\beta^(T/\gamma)g^Tc_0\prod\limits_{t=1}^{T}R_t$\ where $R_t=\alpha k_t^{\alpha-1}+1-\delta$
The code I have attempted is below, but it is clearly incorrect as it does not like what I've tried (I have defined the variables being referred to with specific values, but I did not include those in this code sample):
t=1;
k(1)=kyratio^(1/(1-alpha));
R(1)=alpha*k(1)^(alpha-1)+1-delta
for t=2:105 j=1:105;
k(t+1)=(1-delta)*k(t)+k(t)^alpha-(beta^(1/gamma)*symprod(R(j+1),j,1,t))*czero*gstar^(-(t-1)) ;
R(j)=alpha*k(t)^(alpha-1)+1-delta ;
end
Thanks in advance for any resources you can point me towards, or any advice you give me!

댓글 수: 2
Walter Roberson
2015년 10월 16일
Please explain what you intended by
for t=2:105 j=1:105;
jlpva
2015년 10월 16일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!