Error with ODE and nargin

2 Ansichten (letzte 30 Tage)
Divya Noonela
Divya Noonela am 18 Sep. 2020
Kommentiert: Divya Noonela am 23 Sep. 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 Kommentare
VBBV
VBBV am 19 Sep. 2020
% if true
% code
%end
[t,x] = ode45(@glucoseff,[0 10],x0)
Divya Noonela
Divya Noonela am 23 Sep. 2020
ug is a vector of same size of a

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by