Index Exceeds number of array elements (1)
Show older comments
function ydot = fossil_fules(t,y)
p=y(1);os=y(2);od=y(3);as=y(4);ad=y(5);
r= [0.0,0.0,1.0,4.0,5.0,8.0,10.0,10.5,10.0,8.0,3.5,2.0,0.0,0.0];
yr= [1000,1850,1950,1980,2000,2050,2080,2100,2120,2150,2225,2300,2500,5000];
f = pchip(yr,r);
d = 8.65;
m1 =4.95*10^2;
m2 =4.95*10^-2;
vs =0.12;
vd =1.23;
w =10^-3;
k1 =2.19*10^-4;
k2 =6.12*10^-5;
k3 =0.997148;
k4 =6.79*10^-2;
hs = (os-(os^2 - k3*as*(2*os-as))^0.5) / k3;
cs = (as-hs)/2;
ps = k4*((hs^2)/cs);
ydot = [(ps-p/d)+f(t)/m1 ; 1/vs*((od-os)*w-k1-(ps-p/d)*m2) ; 1/vd *(k1-(od-os)*w) ; 1/vs *((ad-as)*w-k2) ; 1/vd *(k2-(ad-as)*w)];
end
Error is in line 3 "p=y(1);os=y(2);od=y(3);as=y(4);ad=y(5);"
Accepted Answer
More Answers (0)
Categories
Find more on Programming 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!