필터 지우기
필터 지우기

Why is the ODE solver saying not enough input arguments?

조회 수: 1 (최근 30일)
Mohannad Abboushi
Mohannad Abboushi 2016년 2월 28일
편집: Mohannad Abboushi 2016년 2월 28일
In this program I am modeling the cell cycle with three differential equations. I am trying to output all three variables C, M and X to a graph, but I am missing something. Here's the code:
function Cellcycle= Cellcycle (~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~)
K1 = 0.005;
K2 = 0.005;
K3 = 0.005;
K4 = 0.005;
Kc = 0.5;
Kd = 0.02;
kd = 0.01;
V2 = 1.5;
V4 = 0.5;
vd = 0.25;
VM1 = 3;
VM3 = 1;
C = 0.01;
M = 0.01;
X = 0.01;
dC= 0.025-vd*X*(C/(Kd+C)) - kd*C;
dM = VM1*(C/(Kc+C))*((1-M)/(K1+(1-M))) - V2*(M/(K2+M));
dX = M*VM3*((1-X)/(K3+(1-X))) - V4*(X/(K4+X));
Cellcycle= [dC dM dX];
[~,~,~,~,~,~,~,~,~,~,~,~,~,~,~,~] = ode45('Cellcycle',ode45,[0 10],[.01 .01 .01]);
plot(dC,dM,dX);
end

채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 28일
Note that you are ignoring the ode inputs, so your calls are always going to return the same thing, with a rather boring output as a result. I have taken the liberty of guessing what you are trying to do and changing the code appropriately
function Cellcycle_driver
[t,y] = ode45(@Cellcycle, [0 10], [.01 .01 .01]);
dC = y(:,1);
dM = y(:,2);
dX = y(:,3);
plot(t, dC, 'g', t, dM, 'b', t, dX, 'r');
legend({'dC', 'dM', 'dX'});
function dy = Cellcycle(t, y)
K1 = 0.005;
K2 = 0.005;
K3 = 0.005;
K4 = 0.005;
Kc = 0.5;
Kd = 0.02;
kd = 0.01;
V2 = 1.5;
V4 = 0.5;
vd = 0.25;
VM1 = 3;
VM3 = 1;
% C = 0.01;
% M = 0.01;
% X = 0.01;
C = y(1):
M = y(2);
X = y(3);
dC= 0.025-vd*X*(C/(Kd+C)) - kd*C;
dM = VM1*(C/(Kc+C))*((1-M)/(K1+(1-M))) - V2*(M/(K2+M));
dX = M*VM3*((1-X)/(K3+(1-X))) - V4*(X/(K4+X));
dy = [dC; dM; dX];
  댓글 수: 1
Mohannad Abboushi
Mohannad Abboushi 2016년 2월 28일
편집: Mohannad Abboushi 2016년 2월 28일
I made into one function because it was giving some weird error message with cellcycle_driver. It's saying, "Not enough input arguments. Error in Cellcycle (line 17) C= y(1);"
function dy = Cellcycle(t, y)
K1 = 0.005;
K2 = 0.005;
K3 = 0.005;
K4 = 0.005;
Kc = 0.5;
Kd = 0.02;
kd = 0.01;
V2 = 1.5;
V4 = 0.5;
vd = 0.25;
VM1 = 3;
VM3 = 1;
% C = 0.01;
% M = 0.01;
% X = 0.01;
C = y(1);
M = y(2);
X = y(3);
%Differential equations%
dC= 0.025-vd*X*(C/(Kd+C)) - kd*C;
dM = VM1*(C/(Kc+C))*((1-M)/(K1+(1-M))) - V2*(M/(K2+M));
dX = M*VM3*((1-X)/(K3+(1-X))) - V4*(X/(K4+X));
dy = [dC; dM; dX];
%ODE Solver%
[t,y] = ode45(@Cellcycle, [0 10], [.01 .01 .01]);
dC = y(:,1);
dM = y(:,2);
dX = y(:,3);
plot(t, dC, 'g', t, dM, 'b', t, dX, 'r');
legend({'dC', 'dM', 'dX'});
end

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by