[討論] 用ODE45解多聯立已回收

看板MATLAB作者 (colgate)時間15年前 (2010/12/11 00:41), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
想解一多變數聯立解:x(1)~(7) 程式如下: function ydot = mass_20(t,x) A=(2.9*10^-5)*61.7*x(1)*8.314*x(7)/... (1+61.7*x(1)*8.314*x(7)+37.4*x(2)*8.314*x(7)+11.35*x(6)*8.314*x(7)); B=(3.1*10^-4)*37.4*61.7*x(1)*8.314*x(7)*x(2)*8.314*x(7)... /((1+61.7*x(1)*8.314*x(7)+37.4*x(2)*8.314*x(7)+11.35*x(6)*8.314*x(7))^2); C=(10^-4)*11.35*37.4*(x(6)*8.314*x(7)*x(2)*8.314*x(7)-x(3)*8.314*x(7)*((x(4)*8.314*x(7))^4)... /(10^-4*11.35*37.4))... /((1+61.7*x(1)*8.314*x(7)+37.4*x(2)*8.314*x(7)+11.35*x(6)*8.314*x(7))^2); D=(2.4*10^-4)*37.4*11.35*(37.4*x(6)*8.314*x(7)*(x(2)*8.314*x(7))^2-((x(3)*8.314*x(7))^2... *((x(4)*8.314*x(7))^4)/(2.4*10^-4*11.35*37.4)))... /((1+61.7*x(1)*8.314*x(7)+37.4*x(2)*8.314*x(7)+11.35*x(6)*8.314*x(7))^3); y(1)=10*(x0(1)-x(1))-A-B y(2)=10*(x0(1)-x(1))-B-C-2*D; y(3)=10*(x0(3)-x(3))+B+D; y(4)=10*(x0(4)-x(4))+A+2*B+3*C+4*D; y(5)=10*(x0(5)-x(5))+A+C; y(6)=10*(x0(6)-x(6))+A+B-C-D; y(7)=-10*(x0(7)-x(7))-A*49000-B*8730-C*206000-D*164900; ydot=[y(1);y(2);y(3);y(4);y(5);y(6);y(7)]; end ------------------------------------------------------------------------------ x0=[10,20,0,0,0,0,800]; [t,x]=ode45('mass_20',[0,10],x0); 錯誤訊息: ??? Undefined function or method 'x0' for input arguments of type 'double'. Error in ==> mass_20 at 11 y(1)=10*(x0(1)-x(1))-A-B; Error in ==> odearguments at 110 f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0. Error in ==> ode45 at 173 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ... --------------------------------------------------------------------------- 請問我那裡打錯了?????? 感恩~~~~ matlab 無敵超新手.......... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.41.74.25

12/11 00:49, , 1F
x0要放在y的前面
12/11 00:49, 1F

12/11 10:18, , 2F
恩~~試試 謝謝!!
12/11 10:18, 2F
文章代碼(AID): #1D0bWmk3 (MATLAB)