How can I fix this error?
显示 更早的评论
Hello, I want to find a ksi value for the K values I obtained from the T values, but when I run the code even though my K values are there vpasolve gives me this message: "Empty sym: 0-by-1" I would really appreciate if you can guide me. Thanks.
clc;
clear;
nN2 = 1; %starting mol
nH2 = 3; %starting mol
nNH3 = 0; %starting mol
R = 8.314;%J/molK
deltaGstd = -33; %kJ/mol
deltaHstd = -92.2; %kJ/mol
deltaSstd = -0.1987; %(deltaGstd - deltaHstd)/(-T)
syms ksi
T = 298:1:434; %T values
K = exp(((-1).*deltaHstd.*1000 + T.*deltaSstd.*1000)./(R.*T)) %K values
eqn =((4.*ksi.^2)./((4-2.*ksi).^2))./(((1-ksi)./(4-2.*ksi)).*(((3-3.*ksi)./(4-2.*ksi)).^3))==K
S = vpasolve(eqn,ksi)
3 个评论
Rik
2021-6-5
Are you sure there is a solution and you didn't make a typo?
Houssem
2021-6-5
I think you can make a loop on T
Pleas try this code
clc;
clear;
nN2 = 1; %starting mol
nH2 = 3; %starting mol
nNH3 = 0; %starting mol
R = 8.314;%J/molK
deltaGstd = -33; %kJ/mol
deltaHstd = -92.2; %kJ/mol
deltaSstd = -0.1987; %(deltaGstd - deltaHstd)/(-T)
syms ksi
for T = 298:1:434; %T values
K = exp(((-1).*deltaHstd.*1000 + T.*deltaSstd.*1000)./(R.*T)); %K values
eqn =((4.*ksi.^2)./((4-2.*ksi).^2))./(((1-ksi)./(4-2.*ksi)).*(((3-3.*ksi)./(4-2.*ksi)).^3))==K;
S = vpasolve(eqn,ksi)
end
asli eylul sert
2021-6-5
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Numeric Solvers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!