Why does it give me errors during numerical integration?

Greetings,
When I run the following code for a numerical integration:
T = @(x) T0 + (-Hrxn)./(CpSum).*x;
K = @(x) K0.*exp(-E0./(R.*T));
Keq = @(x) exp(-4.33+4577.9./T);
yA = @(x) FA0./FT.*(1-x);
yB = @(x) FB0./FT.*(thetaB-x);
yC = @(x) FC0./FT.*(thetaC+x);
yD = @(x) FD0./FT.*(thetaD+x);
rA = @(x) K.*(yA.*yB-yC.*yD./Keq);
V = integral(@(x) FA0./rA,0,0.493647527)
it shows the following error:
I believe it has to do with the function handle or operators, but I could not figure it out.

 采纳的回答

T0=1;Hrxn=1;CpSum=1;K0=1;E0=1;R=1;FA0=1;FB0=1;FC0=1;FD0=1;thetaB=1;thetaC=1;thetaD=1;FT=1;
T = @(x) T0 + (-Hrxn)./(CpSum).*x;
K = @(x) K0.*exp(-E0./(R.*T(x)));
Keq = @(x) exp(-4.33+4577.9./T(x));
yA = @(x) FA0./FT.*(1-x);
yB = @(x) FB0./FT.*(thetaB-x);
yC = @(x) FC0./FT.*(thetaC+x);
yD = @(x) FD0./FT.*(thetaD+x);
rA = @(x) K(x).*(yA(x).*yB(x)-yC(x).*yD(x)./Keq(x));
V = integral(@(x) FA0./rA(x),0,0.493647527)
V = 4.4877

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Function Handles 的更多信息

产品

版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by