Array indices must be positive integers or logical values.
2 views (last 30 days)
Show older comments
f2=@(t,cSrum) (c1*exp(lambda(b-t))*(flm/fpf)*cSrlm(i))-(c1*exp(lambda(b-t))*flm*cSrlm(i)*18)-(c1*exp(lambda(b-t))*(1-flm)*c*25)+(c2*y(i)*exp(lambda*(b-t))*(1-fc)*cSrcc(i)*1);
k9 =f2(t(i), cSrum(i));
k10=f2(t(i)+0.5*h,cSrum(i)+0.5*k9*h);
k11=f2(t(i)+0.5*h,cSrum(i)+0.5*k10*h);
k12=f2(t(i)+h,cSrum(i)+k11*h);
%update y;
cSrum(i+1)=cSrum(i)+h/6*(k9+2*k10+2*k11+k12);
Error in
crustalgrowthradiogenicSr>@(t,cSrum)(c1*exp(lambda(b-t))*(flm/fpf)*cSrlm)-(c1*exp(lambda(b-t))*flm*cSrlm(i)*18)-(c1*exp(lambda(b-t))*(1-flm)*c*25)+(c2*y(i)*exp(lambda*(b-t))*(1-fc)*cSrcc(i)*1)
Error in crustalgrowthradiogenicSr (line 58)
k9 =f2(t(i), cSrum(i));
2 Comments
James Tursa
on 8 Apr 2020
There are lots of places where this could be going wrong. Please show us the entire code so that we know what all of the variables involved are.
Answers (1)
Ameer Hamza
on 8 Apr 2020
Change the line
f2=@(t,cSrum) (c1*exp(lambda(b-t))*(flm/fpf)*cSrlm(i))-(c1*exp(lambda(b-t))*flm*cSrlm(i)*18)-(c1*exp(lambda(b-t))*(1-flm)*c*25)+(c2*y(i)*exp(lambda*(b-t))*(1-fc)*cSrcc(i)*1);
to
f2=@(t,cSrum) (c1*exp(lambda*(b-t))*(flm/fpf)*cSrlm(i))-(c1*exp(lambda*(b-t))*flm*cSrlm(i)*18)-(c1*exp(lambda*(b-t))*(1-flm)*c1*25)+(c2*y(i)*exp(lambda*(b-t))*(1-fc)*cSrcc(i)*1);)*cSrcc*1;
%^ missing ^ missing ^ missing ^ c is not defined ^ missing
0 Comments
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!