I have the following MatLab code:
valin=34;
valr=1;
anni=8;
r=1-(valr/valin)^(1/anni);
quota=zeros(anni,1);
residuo=zeros(anni,1);
for i = 1:anni
quota(i)=r*valin;
residuo(i)=valin-quota(i);
valin=residuo(i);
end
I'd like to "translate" this code to run it on my TI-nspire CAS calculator. I tried this:
Define tassofisso(valin,valr,anni)=
Prgm
:Define r=1-(((valr)/(valin)))^(((1)/(anni)))
:Define rdisp=approx(r)
:Define quota=r*valin
:Define residuo=valin-quota
:Disp rdisp
:For i,1,anni
:quota=r*valin
:residuo=valin-quota
:residuo→valin
:Disp residuo
:EndFor
:EndPrgm
But the code is not working and I don't understand why.
I don't really need the arrays that I have in MatLab, I just need the calculator to display all the values.
Please let me know! Thanks!