I am trying to solve a system of differential equations. I ran into an error, so I attempted to see if I could get the example in the MATLAB help to work first. Here is the code I typed in, and saved as a file:
function dy = rigid(t,y)
dy = zeros(3,1); % a column vector
dy(1) = y(2) * y(3);
dy(2) = y(1) * y(3);
dy(3) = 0.51 * y(1) * y(2);
This is directly from the MATLAB help. Next, I tried to run it by typing the following at the command prompt:
options = odeset('RelTol',1e4,'AbsTol',[1e4 1e4 1e5]);
[T,Y] = ode45(@rigid,[0 12],[0 1 1],options);
The following errors resulted:
??? Error using ==> feval
Undefined function or method 'rigid' for input arguments of
type 'double'.
Error in ==> odearguments at 109
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ==> ode45 at 173
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs,
odeFcn, ...
Can anyone help me figure out what is going wrong? I have a feeling that I am missing something silly. Thanks.
