Azzera filtri
Azzera filtri

Not Enough input arguments/Unexplained line errors

1 visualizzazione (ultimi 30 giorni)
I dont understand what it means when it says not enough input arguments and I am confused with the errors in solution, arguments and ode45. Is it an error in the function or the solution above. Any help would be much appreciated.
Fao=100;
Fbo = 0;
Fco = 0;
WRange=[0 100];
M0 = [Fao;Fbo;Fco];
[WSol,FSol] = ode45(@Membrane,WRange,M0);
Not enough input arguments.

Error in solution>Membrane (line 28)
Ca = (CTo*Fa)/(Fa + Fb + Fc);

Error in odearguments (line 92)
f0 = ode(t0,y0,args{:}); % ODE15I sets args{1} to yp0.

Error in ode45 (line 107)
odearguments(odeIsFuncHandle,odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);
plot(WSol,FSol)
legend("show")
xlabel("Weight (Kg)")
ylabel("F (mol/s)")
legend(["Fa","Fb","Fc"])
title("Problem 5.")
function M = Membrane (Fa, Fb, Fc)
k = 10;
kca = 1;
kcb = 40;
Kc = 0.01;
vo = 100;
Fao = 100;
Fbo = 0;
Fco = 0;
FTo = Fao + Fbo + Fco;
CTo = Fao/vo;
Ca = (CTo*Fa)/(Fa + Fb + Fc);
Cb = (CTo*Fb)/(Fa + Fb + Fc);
Cc = (CTo*Fc)/(Fa + Fb + Fc);
ra = -k*(Ca - ((Cb*Cc^2)/Kc));
rb = k*(Ca - ((Cb*Cc^2)/Kc));
rc = 2*k*(Ca - ((Cb*Cc^2)/Kc));
Ra = kca*Ca;
Rb = kcb*Cb;
dFadW = ra - Ra;
dFbdW = rb - Rb;
dFcdW = rc;
M = [dFadv,dFbdv,dFcdv];
end

Risposta accettata

Walter Roberson
Walter Roberson il 13 Mar 2023
Fao=100;
Fbo = 0;
Fco = 0;
WRange=[0 100];
M0 = [Fao;Fbo;Fco];
[WSol,FSol] = ode45(@Membrane,WRange,M0);
plot(WSol,FSol)
legend("show")
xlabel("Weight (Kg)")
ylabel("F (mol/s)")
legend(["Fa","Fb","Fc"])
title("Problem 5.")
function M = Membrane (t, Fabc)
Fa = Fabc(1); Fb = Fabc(2); Fc = Fabc(3); %all three states in same variable
k = 10;
kca = 1;
kcb = 40;
Kc = 0.01;
vo = 100;
Fao = 100;
Fbo = 0;
Fco = 0;
FTo = Fao + Fbo + Fco;
CTo = Fao/vo;
Ca = (CTo*Fa)/(Fa + Fb + Fc);
Cb = (CTo*Fb)/(Fa + Fb + Fc);
Cc = (CTo*Fc)/(Fa + Fb + Fc);
ra = -k*(Ca - ((Cb*Cc^2)/Kc));
rb = k*(Ca - ((Cb*Cc^2)/Kc));
rc = 2*k*(Ca - ((Cb*Cc^2)/Kc));
Ra = kca*Ca;
Rb = kcb*Cb;
dFadW = ra - Ra;
dFbdW = rb - Rb;
dFcdW = rc;
M = [dFadW;dFbdW;dFcdW]; %must be column vector, and you were using wrong names
end

Più risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by