- #1
Ultimato
- 5
- 0
Hi to everyone, I have some problem in implementing a ODE system in matlab.
function dC = Model(x,C)
dC = zeros(2,1);
dC(1) = -2/C(1) -3*dC(2);
dC(2) = -3/C(2) -4*dC(1);
[x,C] = ode23(@Model(x,C),[0 300],[56.9 0]);
plot(x,C)
The debugger says
"? Input argument "C" is undefined.
Error in ==> HTPEMModel at 3
dC(1) = -2/C(1) -3*dC(2);"
I have tried also one of the examples in the help of MATLAB and gives me the same error:
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);
[T,Y] = ode45(@rigid,[0 12],[0 1 1]);
plot(T,Y(:,1),'-',T,Y(:,2),'-.',T,Y(:,3),'.')
gives me:
"? Input argument "y" is undefined.
Error in ==> rigid at 3
dy(1) = y(2) * y(3);"
What's my mistake?
function dC = Model(x,C)
dC = zeros(2,1);
dC(1) = -2/C(1) -3*dC(2);
dC(2) = -3/C(2) -4*dC(1);
[x,C] = ode23(@Model(x,C),[0 300],[56.9 0]);
plot(x,C)
The debugger says
"? Input argument "C" is undefined.
Error in ==> HTPEMModel at 3
dC(1) = -2/C(1) -3*dC(2);"
I have tried also one of the examples in the help of MATLAB and gives me the same error:
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);
[T,Y] = ode45(@rigid,[0 12],[0 1 1]);
plot(T,Y(:,1),'-',T,Y(:,2),'-.',T,Y(:,3),'.')
gives me:
"? Input argument "y" is undefined.
Error in ==> rigid at 3
dy(1) = y(2) * y(3);"
What's my mistake?