I am having trouble using ode45 to do this is it says that my function is not a column vector but I don't know why it isn't.
f = @(t,x) [-2*x + 4*y; x + 2*y]
tspan = [0 5]
x0 = [0;0]
[t,x] = ode45(f,tspan,x0)
plot(t,x,'-o')
Error using odearguments (line 93)
@(T,X)[-2*X+4*Y;X+2*Y] must return a column vector.
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in prac (line 5)
[t,x] = ode45(f,tspan,x0)
Best Answer