Re: [問題] 非線性ODE求解已回收

看板MATLAB作者 (MATLAB程式編輯員)時間14年前 (2010/03/05 15:23), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/4 (看更多)
※ 引述《YangJimmy (這是有錢人的ID)》之銘言: : 各位先進大家好, : 小弟在解非線性ODE上遇到問題, : 想解的題目如下: : X'=a*X/Y*Y'+b*(X-c) : 其中a.b.c都是常數, : X、Y都是t的函數, : 已知Y(t)= sin(t)+2*cos(t) : 要求X(t) : 如果要用 m file 以ode45求解, : 該怎麼假設會比較好? : 我所知道的如下: : function dx=odedT(t,x) : % X(t)設為 x(1) : % dX(t)設為 x(2) : % Y(t)設為 x(3) : % dY(t)設為 x(4) : dx=[a*x(1)/x(3)*x(4)+b*(x(1)-c); : x(1)'=x(2); : sin(t)+2*cos(t); : x(3)'=x(4)]; : 再以ode45去解 : 不過這樣都解不出來, : 請問有哪個環節出錯嗎?? : 感謝!!! 很久沒上來解題目了.... ----------------------------------------------------------------- function pttex133 global a b c a=1; b=1; c=1; [t x] = ode15s(@pttodexx,[0 10],0) plot(t,x) function f = pttodexx(t,x) global a b c syms z g y = sin(t)+2*cos(t); z = sin(g)+2*cos(g); f = a.*(x./y).*subs(diff(z),t)+b.*(x-c); ----------------------------------------------------------------- 如果有更正確的解法還請分享 -- 1.MATLAB programming 2.ASPEN process simulation package 3.FORTRN programming 4.Advance Engineering Mathematics 5.Process Control Theory 6.Chemical Engineering Basic Theory(Kinetic.thermodynamics.transport) 7.Numerical Method and Analysis 8.MATLAB Toolbox.Simulink system basic design -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 202.132.126.154

03/05 20:01, , 1F
非常感謝!!
03/05 20:01, 1F
文章代碼(AID): #1BaB5-Hz (MATLAB)
文章代碼(AID): #1BaB5-Hz (MATLAB)