- #1
matlabphd
- 2
- 0
Dear all. I am trying to solve an ODE in MATLAB using ODE45 solver. But the programe keep saying
? Input argument "y" is undefined.
Error in ==> lvv at 4
yprime=[a*y(1)-b*y(1)*y(2);-r*y(2)+c*y(1)*y(2)];
Can anybody be of help? Please.
The complete code is this:
function yprime=lvv(t,y)
%LV: Contains Lotka-Volterra equations
a=.5471;b=.0281;c=.0266;r=.8439;
yprime=[a*y(1)-b*y(1)*y(2);-r*y(2)+c*y(1)*y(2)];
[t,y]=ode45(@lvv,[0 20],[30;4])
plot(t,y(:,1))
Thanks
? Input argument "y" is undefined.
Error in ==> lvv at 4
yprime=[a*y(1)-b*y(1)*y(2);-r*y(2)+c*y(1)*y(2)];
Can anybody be of help? Please.
The complete code is this:
function yprime=lvv(t,y)
%LV: Contains Lotka-Volterra equations
a=.5471;b=.0281;c=.0266;r=.8439;
yprime=[a*y(1)-b*y(1)*y(2);-r*y(2)+c*y(1)*y(2)];
[t,y]=ode45(@lvv,[0 20],[30;4])
plot(t,y(:,1))
Thanks