Hi everyone, when I run this code, command window shows me an error that says "Error using principal>odefun (line 41) Not enough input arguments. Error in principal (line 13) [tspan,Y]=ode45(odefun, tspan, y0)"; I'm relatively new to matlab. HELP!

1 visualización (últimos 30 días)
function principal
clc
clear all
close all
Cic=1; %g/dm3
Cis=250; %g/dm3
Cip=0;
y0=[Cic, Cis, Cip];
tspan=[0,20];
[tspan,Y]=ode45(odefun, tspan, y0);
Cc=Y(:,1);
Cs=Y(:,2);
Cp=Y(:,3);
figure (1)
plot(tspan,Cc)
xlabel('Tiempo [h]')
ylabel('Concentración celulas [g/dm3]')
grid on
figure(2)
plot(tspan, Cs)
xlabel('Tiempo [h]')
ylabel('Concentración sustrato [g/dm3]')
figure (3)
plot(tspan, Cp)
xlabel('Tiempo [h]')
ylabel('Concentración producto [g/dm3]')
end
function res=odefun(l,y)
Cc=y(1);
Cs=y(2);
Cp=y(3);
%constantes
Ycs=0.08; %g/g
Yps=0.45; %g/g
kd=0.01; %h-1
Cpast=93; %g/dm3
n=0.52;
miumax=0.33; %h-1
Ks=1.7; %g/dm3
m=0.03; %g de sustrato/gramos de celulas por hora
%calculos
Kobs=(1-(Cp/Cpast))^n;
rg=(Kobs*miumax*Cs*Cc)/(Ks+Cs);
rd=kd*Cc;
dCcdt=rg-rd;
dCsdt=(1/Ycs)*(-rg)-(m*Cc);
dCpdt=Yps*((m*Cc)-((1/Ycs)*(-rg)));
res=[dCcdt; dCsdt; dCpdt];
end

Respuesta aceptada

Walter Roberson
Walter Roberson el 24 de Nov. de 2015
[tspan,Y] = ode45(@odefun, tspan, y0);

Más respuestas (0)

Categorías

Más información sobre Entering Commands 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