Error with ODE and nargin

2 visualizaciones (últimos 30 días)
Divya Noonela
Divya Noonela el 18 de Sept. de 2020
Comentada: Divya Noonela el 23 de Sept. de 2020
Hello, can anyone help me out with this.?
function xdot = glucoseff(t,x)
p1=0.028735;
p2=0.028344;
p3=5.0353e-5;
gb=200;
ib=0;
n=0.10;
vi=12;
a=0:0.1:10
ug=exp(-a);
g=x(1);
y=x(2);
i=x(3);
%
%odes
%
dgdt=(-p1*g)-(t*g)+(p1*gb)+ug;
dydt=(-p2*y)+(p3*i)-(p3*ib);
didt=(-n*i)+ui/vi;
xdot = [dgdt; dydt; didt];
end
clc;
x0=[200;0;10];
[t,x] = ode45('glucoseff',[0 10],0);
plot(x(:,1));
plot(x(:,2));
plot(x(:,3));
I don't understand the error :
Error using nargin
Error: File: glucoseff.m Line: 1 Column: 1
Function definitions are not permitted in this context.
Error in odearguments (line 60)
if (nargin(ode) == 2)
Error in ode45 (line 115)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in glucose_main (line 4)
[t,x] = ode45('glucoseff',[0 10],0);
  3 comentarios
VBBV
VBBV el 19 de Sept. de 2020
% if true
% code
%end
[t,x] = ode45(@glucoseff,[0 10],x0)
Divya Noonela
Divya Noonela el 23 de Sept. de 2020
ug is a vector of same size of a

Iniciar sesión para comentar.

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