Page 1 of 1

problems with for loop

Posted: Tue Mar 08, 2016 11:21 am
by migaa
Hello,

Would you look through my code, please. the program is not working from this line "equation equ!j.ls u{!j-1} c u!j(-1)". How can I solve this part "u{!j-1}?

Code: Select all

create u 54 series y0=nrnd series a0=nrnd equation eqy0.ls y0 c a0 eqy0.makeresids u0 for !j=1 to 10 equation equ!j.ls u{!j-1} c u!j(-1) series y!j = y{!j-1} -y{!j-1}(-1)*equ!j.@coef(2) series a!j = a{!j-1} -a{!j-1}(-1)*equ!j.@coef(2) smpl @first @first series y!j = y{!j-1}*(1-equ!j.@coef(2)^2)^0.5 series a!j = a{!j-1}*(1-equ!j.@coef(2)^2)^0.5 smpl @all equation eqy!j.ls y!j c a!j eqy!j.makeresids u!j equation equ{!j+1}.ls u!j c u!j(-1) if equ!j.@coef(2) - equ{!j-1}.@coef(2)<0.05 then exitloop endif next
Thanks in advance.

Miga.B

Re: problems with for loop

Posted: Tue Mar 08, 2016 11:34 am
by EViews Gareth

Code: Select all

!k = !j-1 equation equ!j.ls u{!k} c u!j(-1)

Re: problems with for loop

Posted: Tue Mar 08, 2016 8:03 pm
by migaa
Thank you Gareth. :)