Torsten
Posts:
1,630
Registered:
11/8/10


Re: diff eq
Posted:
Apr 11, 2013 2:27 AM


> > > > By the way: > > You should call ODE45 with a row vector of inital values, i.e. > > [t,a] = ode45(@eq1, [0:.1:10], [1 0 0 0]) > > > > Best wishes > > Torsten. > > Are you sure that the initial conditions need to be a row vector? > This seems to work for row and column vectors: > > A = [2.4712 0.005 0.56 0.1; 0.385 0.1002 0 0; 0 0.002 0.6462 0; 0 0.007 0 0.2042] > tstDV = @(t,x) A*x; > x0 = [1;2;3;4] > tspan = [0 10] > [t,y] = ode45(tstDV, tspan,x0); > plot(t,y) > > Gives the same as > [t2,y2] = ode45(tstDV, tspan,x0'); > plot(t2,y2)
I don't know  I just saw that in all the examples, row vectors are used for the initial conditions. Although this is inconsistent with the prescription of derivatives which have to be supplied as column vector ...
Best wishes Torsten.

