How do I assign the values in my vector to their respective variables in the equation?
5 views (last 30 days)
Show older comments
% A script that calculates the vapor pressures for pure components at
% different temperatures using the Antoine equation.
% Script will find Psat in units of mmHg (p_mmHg)
% Check that we are in the range of applicability
%Calculating log Psat with Psat in mmHg
Antoine = zeros(1,length(t_C)-1);
for t_C = 1:10:100
(a;b;c) = [6.9038, 1163.03, 227.4; 6.84498, 1203.526, 222.863; 7.09808, 1238.71, 217; 7.87863, 1473.11, 230; 6.90240, 1268.115, 216.9];
log_p_mmHg(Antoine) = a-b/(t_C+c);
end
%Psat in mmHg
p_mmHg = 10.^log_p_mmHg
0 Comments
Answers (1)
Star Strider
on 24 Feb 2022
Taking a wild guess, perhaps something olike this (assuming that ‘a’ is the first matrix column, etc.) —
Mabc = [6.9038, 1163.03, 227.4; 6.84498, 1203.526, 222.863; 7.09808, 1238.71, 217; 7.87863, 1473.11, 230; 6.90240, 1268.115, 216.9];
t_C = linspace(1, 100, size(Mabc,1));
for k = 1:numel(t_C)
log_p_mmHg(k) = Mabc(k,1)-Mabc(k,2)./(t_C(k)+Mabc(k,3));
end
figure
plot(t_C, log_p_mmHg)
grid
xlabel('t_C')
ylabel('log(p) mmHg')
The dimensions must match.
.
0 Comments
See Also
Categories
Find more on General Applications 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!