Looking at following series of ODE equations.
function du=tony(t,u) du=zeros(10,1);
dx=0.500000;
dz=0.625000;
ta=300.000000;
sx=4.666290;
sz=2.986426;
hs=0.000250;
du(1)=sx*(((ta-u(1))*hs*dx)+(u(2)-u(1)))+sz*(((ta-u(1))*hs*dz)+(u(6)-u(1)));
du(2)=sx*((u(1)-u(2))+(u(3)-u(2)))+sz*(((ta-u(2))*hs*dz)+(u(7)-u(2)));
du(3)=sx*((u(2)-u(3))+(u(4)-u(3)))+sz*(((ta-u(3))*hs*dz)+(u(8)-u(3)));
du(4)=sx*((u(3)-u(4))+(u(5)-u(4)))+sz*(((ta-u(4))*hs*dz)+(u(9)-u(4)));
du(5)=sx*((u(4)-u(5))+((ta-u(5))*hs*dx))+sz*(((ta-u(5))*hs*dz)+(u(10)-u(5)));
du(6)=sx*(((ta-u(6))*hs*dx)+(u(7)-u(6)))+sz*((u(1)-u(6))+((ta-u(6))*hs*dz));
du(7)=sx*((u(6)-u(7))+(u(8)-u(7)))+sz*((u(2)-u(7))+((ta-u(7))*hs*dz));
du(8)=sx*((u(7)-u(8))+(u(9)-u(8)))+sz*((u(3)-u(8))+((ta-u(8))*hs*dz));
du(9)=sx*((u(8)-u(9))+(u(10)-u(9)))+sz*((u(4)-u(9))+((ta-u(9))*hs*dz));
du(10)=sx*((u(9)-u(10))+((ta-u(10))*hs*dx))+sz*((u(5)-u(10))+((ta-u(10))*hs*dz));
These equations can be solved by ode45 solver. However, although I followed the ode45 documentation, the results are not what I expected.
The problem is that: in the command window, I input:
[t,u]=ode45(@tony,[0 0.007],300+zeros(10,1))%initial values are all 300.
The values of u are surprisingly all 300. It is really strange.
Can anyone explain it to me please? And please tell me how I can modify the code?
Thanks,
Tony
No products are associated with this question.
4 Comments
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/83641#comment_162331
Why your question is NOT "urgent" or an "emergency"!
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/83641#comment_162340
Hint: you want to use an ode solver in Matlab. Look at the documentation for ode45 or similar
As it turns out, you basically already have the equations in the required form for the solver, to calculating the transient solution should be fairly straightforward.
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/83641#comment_162343
Thanks Matt!
I will take a look at ode45.
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/83641#comment_162548
Have you tried a different set of initial conditions? Since you don't have time explicitly in your equations, maybe the equations are just solving for the steady-state solution (du===0) already.