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 view (last 30 days)
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

Accepted Answer

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

More Answers (0)

Categories

Find more on Entering Commands in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!