I don't understand where the error is. I just got the message "Not enough input arguments". can someone explain to where the error lies in the source code that I wrote? thanks

5 次查看(过去 30 天)
function dydt= MKT(t,y)
% %parameter
a=(4.31)*10^(-1);b=(1.02)*10^(-9);c=(2.9077)*10^(-13);
d=(4.5)*10^(-8);Kt=(9)*10^(-1);delta=1.8328;
e=(1.29)*10^(-3);f=(4)*10^(-1);g=(2.08)*10^(-7);
p=(2.794)*10^(-13);pn=(6.68)*10^(-2);gn=(2.5036)*10^(5);
Kn=(6.75)*10^(-2);teta=(2.5036)*10^(-3);m=(9)*10^(-3);
j=(1.245)*10^(-2);k=(2.5036)*10^(7);q=(3.422)*10^(-10);
r1=(2.9077)*10^(-11);r2=(5.8467)*10^(-13);u=(4.417)*10^(-14);
kappa=(2.5036)*10^(3);Kl=(4.86)*10^(-2);Pi=2.971;
gi=(2.5036)*10^(3);alpha=(7.50)*10^(8);beta=(6.3)*10^(-3);
Kc=(3.4)*10^(-2);gamma=(5.199)*10^(-1);miu=11.7427;
phi=(2.38405)*10^(-7);vi=(2.7859)*10^(6);vl=(1.77)*10^(10);
vm=2.3869;
%Sistem Persamaan
dydt=[(a*y(1)*(1-b*y(1)))-(c*y(2)*y(1))-(d*y(3)*y(1))-(Kt*(1-e^(delta*y(5)))*y(1));
(g*y(4))-(f*y(2))-(p*y(2)*y(1))+((pn*y(2)*y(6))/(gn+y(6)))-(Kn*(1-e^(delta*y(5)))*y(2));
(-(teta*m*y(3))/(teta+y(6)))+((j*y(1)*y(3))/(k+y(1)))-(q*y(3)*y(1))+((r1*y(2)+r2*y(4))*y(1))-((u*y(3)^2*y(4)*y(6))/(k+y(6)))-(Kl*(1-e^(delta*y(5)))*y(3))+((pi*y(3)*y(6))/(gi+y(6)))+(Vl);
((alpha)-(beta*y(4))-(Kc*(1-e^(delta*y(5)))*y(4)));
(-gamma*y(5))+(Vm);
(-miu+phi*y(4))+(Vi)];
end

回答(1 个)

Ishu
Ishu 2024-8-29
Hi Abd Mukit,
The error you are encountering is due to attempting to run this function file directly.
To use this function, you should create another .m file and call this function from that file with the appropriate arguments.
Based on the code provided, I assume that this function is intended to be used with an ODE solver, such as "ode45".
Below is an example code that you can follow:
% Below code to be added in new .m file
yo = [1,3,5,4,1,3];
to = [0,15];
[t,y] = ode45(@MKT, to, yo);
You can refer the following documentation for more information on "ode45":

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by