debugging problem with ode45

1 回表示 (過去 30 日間)
xue
xue 2012 年 2 月 15 日
I'm a matlab beginner,now have problems with the following code function dy=co2(t,y); %t=[0:1:3000]; y=ones(12,1); dy=ones(12,1); % a column vector dy(1)=0.076*1e-16*y(2)+341.28*y(6)-682.56*y(1)+341.28*y(11)-0.4439*1e-9*y(1)*y(1)/(5.42*1e7+1800*y(2)+30133*y(1))/(y(1)+15+0.0313*y(3)); dy(2)=-0.413681e3*y(2)-0.0716*1e-16*y(2)+0.2068*1e3*y(4)+0.2068*1e3*y(5); dy(3)=1.86*1e-9*y(1)*y(1)/(5.42*1e7+1800*y(2)+30133*y(1))/(y(1)+15+0.0313*y(3))-159.1*(y(3)-250); dy(4)=0.02471e-15*y(7)/(y(7)+130)-0.0856*1e3*(y(4)-y(2)); dy(5)=0.02471e-15*y(8)/(y(8)+130)-0.0856*1e3*(y(5)-y(2)); dy(6)=39*(y(1)-y(6))+0.2445*1e-11*y(7)/(5.42*1e7+1800*y(7)+30133*y(6))-0.0508*1e-9*y(6)/(5.42*1e7+1800*y(7)+30133*y(6))-1.4286*1e-3*(y(6)-y(9)); dy(7)=0.0055*1e-15*y(10)/(y(10)+130)+0.0508*1e-9*y(6)/(5.42*1e7+1800*y(7)+30133*y(6))-0.2445*1e-11*y(7)/(5.42*1e7+1800*y(7)+30133*y(6))-6.8*1e-18*y(7)/(y(7)+130); dy(8)=3.96*1e-15*y(12)/(y(12)+130)-3.96*1e-15*y(8)/(y(8)+130); dy(9)=33.5641*1e-3*(y(6)-y(9))+1.034*1e-10*y(10)/(5.42*1e7+1800*y(10)+30133*y(9))-2.148*1e-9*y(9)/(5.42*1e7+1800*y(10)+30133*y(9))-14.76*1e3*(y(9)-1); dy(10)=9.031*1e3*(13.5-y(10))+2.15*1e-9*y(9)/(5.42*1e7+1800*y(10)+30133*y(9))-1.034*1e-10*y(10)/(5.42*1e7+1800*y(10)+30133*y(9))-0.128*1e-15*y(10)/(y(10)+130); dy(11)=0.2268*1e-3*(y(1)-y(11))+1.034*1e-10*y(12)/(5.42*1e7+1800*y(12)+30133*y(11))-2.149*1e-9*y(11)/(5.42*1e7+1800*y(12)+30133*y(11))-10.25*1e3*(y(11)-1); dy(12)=9.0308*1e3*(13.5-y(12)+2.149*1e-9*y(11)/(5.42*1e7+1800*y(12)+30133*y(11))-1.0343*1e-10*y(12)/(5.42*1e7+1800*y(12)+30133*y(11))-0.1282*1e-15*y(12)/(y(12)+130)); %In this example we change the error tolerances using the odeset command and solve on a time interval [0 12] with an initial condition vector zeros(12,1) at time 0. options = odeset('RelTol',1e-4,'AbsTol',[1e-4 1e-4 1e-5]); [t,y]=ode45(dy,[0 3000],ones(12,1),options)
the running result is: ??? Error using ==> exist The first input to exist is a string. Error in ==> odearguments at 80 if (exist(ode)==2) % M-file Error in ==> ode45 at 173 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ... Error in ==> co2 at 20 [t,y]=ode45(dy,[0 3000],ones(12,1),options)

回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by