From: Martin H. <ma...@mh...> - 2012-09-05 13:21:42
|
Am 05.09.2012 15:11, schrieb davide prandi: > Thanks to everyone. > I had already tried to change the variable's order with '@', but the > method solves a SYSTEM of differential equations. I give you an example: > > [T,Y]=ode23s(@fun, [0 5], [1 2 3]); > > where 'fun' is a vector of equations: > > function Fv=fun(Y,t) > Fv(1,1)=2*Y(1)+Y(2)+5*Y(3)+exp(-2*t); > Fv(2,1)=-3*Y(1)-2*Y(2)-8*Y(3)+2*exp(-2*t)-cos(3*t); > Fv(3,1)=3*Y(1)+3*Y(2)+2*Y(3)+cos(3*t); > > > The problem is: all of ode solvers take in input function in fun(t,Y) > form. dfxpdp computes jacobian matrix with function in fun(Y,t) form. > Obviously fun(t,Y) is user-defined, and I've to find a way to convert > fun(t,Y) in fun(Y,t) form. When this problem is fixed, I can upload > the .m file. > > Thanks, > > Davide > Just attach your m file, your problem is most probably easy to solve when seeing the code, most likely you have to change a single function call as Olaf Till showed you. |