Not Enough input arguments/Unexplained line errors

1 回表示 (過去 30 日間)
Brianna Biondo
Brianna Biondo 2023 年 3 月 13 日
コメント済み: Brianna Biondo 2023 年 3 月 13 日
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

採用された回答

Walter Roberson
Walter Roberson 2023 年 3 月 13 日
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
  1 件のコメント
Brianna Biondo
Brianna Biondo 2023 年 3 月 13 日
Thank you so much. I really appreciate the help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by