not enough input argument error

4 visualizaciones (últimos 30 días)
aubelee
aubelee el 21 de Abr. de 2021
Comentada: Stephan el 21 de Abr. de 2021
I am trying to run this code, however, it seems that it's giving me a not enough input error (Not enough input arguments.
Error in repressilator (line 7), m1 = -y(1) + alpha/(1+y(6)^n) + alpha0;). Could someone please help me to run this?
function ydot=repressilator(t,y,p)
alpha0 = 1;
n = 2.0;
beta = 5;
alpha = 1000;
% order of species; y = [m1 p1 m2 p2 m3 p3]
m1 = -y(1) + alpha/(1+y(6)^n) + alpha0;
p1 = -beta*(y(2) - y(1));
m2 = -y(3) + alpha/(1+y(2)^n) + alpha0;
p2 = -beta*(y(4) - y(3));
m3 = -y(5) + alpha/(1+y(4)^n) + alpha0;
p3 = -beta*(y(6) - y(5));
ydot = [m1; p1; m2; p2; m3; p3];
timespan=[0 15];
y0 = [0 1 0 1 0 1];
[t,y] = ode45(@repressilator,timespan,y0);
figure()
plot(t,y)
xlabel('Time')
ylabel('Amount')
legend('m1','p1','m2','p2','m3','p3','Location','SouthEast')
figure()
plot(y(:,1), y(:,2))
xlabel('Amount m1')
ylabel('Amount p1')

Respuesta aceptada

Stephan
Stephan el 21 de Abr. de 2021
timespan=[0 15];
y0 = [0 1 0 1 0 1];
[t,y] = ode45(@repressilator,timespan,y0);
figure()
plot(t,y)
xlabel('Time')
ylabel('Amount')
legend('m1','p1','m2','p2','m3','p3','Location','SouthEast')
figure()
plot(y(:,1), y(:,2))
xlabel('Amount m1')
ylabel('Amount p1')
function ydot=repressilator(~,y)
alpha0 = 1;
n = 2.0;
beta = 5;
alpha = 1000;
% order of species; y = [m1 p1 m2 p2 m3 p3]
m1 = -y(1) + alpha/(1+y(6)^n) + alpha0;
p1 = -beta*(y(2) - y(1));
m2 = -y(3) + alpha/(1+y(2)^n) + alpha0;
p2 = -beta*(y(4) - y(3));
m3 = -y(5) + alpha/(1+y(4)^n) + alpha0;
p3 = -beta*(y(6) - y(5));
ydot = [m1; p1; m2; p2; m3; p3];
end
  2 comentarios
aubelee
aubelee el 21 de Abr. de 2021
it gives me :>> repressilator(y, p)
Unrecognized function or variable 'y'.
Stephan
Stephan el 21 de Abr. de 2021
See my edited answer - the code works

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by