Mathematical Modelling for simulation . Error in ODE45.

1 次查看(过去 30 天)
kemo()
Array indices must be positive integers or logical values.

Error in solution>kemo/kk (line 51)
dxdt_3=((-teta*em*L)/(teta+I))+j*(T/(k+T))*L-q*L*T+(r1*N+r2*C)*T((u*(L^2)*C*I)/(kappa+I))+((pie*L*I)/(gi+I))-kl*(1-exp(delta*M))*L;

Error in odearguments (line 92)
f0 = ode(t0,y0,args{:}); % ODE15I sets args{1} to yp0.

Error in ode45 (line 107)
odearguments(odeIsFuncHandle,odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);

Error in solution>kemo (line 22)
[t,x]=ode45(@kk,t,[initial_t;initial_n;initial_l;initial_c;initial_i;initial_m]);
function kemo
t=0:0.1:200;
a=(4.31)*10^(-1); b=(1.02)*10^(-9); c=(2.9077)*10^(-13);delta=1.8328;
d=4.5*10^(-8);ef=0.111;f=(4)*10^(-1);p=(2.794)*10^(13);pn=(6.68)*10^(-2);gn=(2.5036)*10^5;
em =9*10^(-3);teta=(2.5036)*10^(-3);q=(3.422)*10^(10);r1=(2.9077)*10^(-11);r2=(5.8467)*10^(13);pie=2.971;gi=(2.5036)*10^3;u=(4.417)*10^(-14);
kappa=(2.5036)*10^3;j=(1.245)*10^(2);k=(2.019)*10^3;miu=11.7427;phi=(2.38405)*10^(-2);
kt=0.9;kn=0.0675;kl=0.0486;kc=0.034;gamma=0.5199;
vl=(1.77)*10^10;vm=2.3869;vi=2.7859*10^6;
alphabeta=(2.25)*10^(9);beta=(6.3)*10^(-3);
initial_t=10^7;
initial_n=2.5*10^8;
initial_l=5*10^4;
initial_c=2.25*10^9;
initial_i=1073;
initial_m=0;
[t,x]=ode45(@kk,t,[initial_t;initial_n;initial_l;initial_c;initial_i;initial_m]);
figure (1)
semilogy(t,x(:,6),'b','LineWidth',2);
title('Grafik M terhadap t','Fontsize',15);
xlabel('waktu(hari)','Fontsize',15);
ylabel('M(t)(mg/liter)','Fontsize',15);
axis([0 30 10^0 10^12]);
grid on
figure(2)
semilogy(t,x(:,1),'b',t,x(:,2),'g',t,x(:,3),'r',t,x(:,4),'c',t,x(:,5),'y','LineWidth',1);
xlabel('waktu(hari)','Fontsize',15);
% ylabel('','Fontsize',15);
legend('Sel tumor T(t)','Sel NK N(t)','Sel T-CD8+L(t)','Sellimfosit C(t)','IL-2 I(t)')
axis([0 200 10^0 10^12]);
grid on
function dxdt=kk(t,x)
T=x(1);
N=x(2);
L=x(3);
C=x(4);
I=x(5);
M=x(6);
dxdt_1=a*T*(1-b*T)-c*N*T-d*L*T-kt*(1-exp(-delta*M))*T;
dxdt_2=f*((ef)*C-N)-p*N*T+((pn*N*I)/(gn+I))-kn*(1-exp(delta*M))*N;
dxdt_3=((-teta*em*L)/(teta+I))+j*(T/(k+T))*L-q*L*T+(r1*N+r2*C)*T((u*(L^2)*C*I)/(kappa+I))+((pie*L*I)/(gi+I))-kl*(1-exp(delta*M))*L;
dxdt_4=beta*(alphabeta-C)-kc*(1-exp(-delta*M))*C;
dxdt_5=-miu*I+phi*C;
dxdt_6=-gamma*M+vm;
dxdt=[dxdt_1;dxdt_2;dxdt_3;dxdt_4;dxdt_5;dxdt_6];
end
end
Can help me to fix that ?
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in kemo (line 20)
[t,x]=ode45(@kk,t,[initial_t;initial_n;initial_l;initial_c;initial_i;initial_m]);
  2 个评论
John D'Errico
John D'Errico 2022-7-18
When you get an error, show the COMPLETE error message, thus everything in red. Merely saying there is an error, even if you show the line it happens in, is not any real help.
If you want help, then make it easy to get help.
Torsten
Torsten 2022-7-19
编辑:Torsten 2022-7-19
dxdt_3=((-teta*em*L)/(teta+I))+j*(T/(k+T))*L-q*L*T+(r1*N+r2*C)*T((u*(L^2)*C*I)/(kappa+I))+((pie*L*I)/(gi+I))-kl*(1-exp(delta*M))*L;
here
There is an arithmetic operator missing after the "T".

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by