Matrix Dimensions must agree
Afficher commentaires plus anciens
FUNCTION:
function P = preos_P(V, T, Pc, Tc, w)
R = 8.314;
Tr = T./Tc;
a = 0.4572355289.*(R.^2.*T.^2./Pc);
b = 0.0777960739*(R.*Tc./Pc);
k= 0.37464+1.54226.*w-0.26992.*w.^2;
alpha = (1+k.*(1-Tr.^1/2)).^2;
P = (R.*T./(V-b))-(alpha.*a)/(V.^2+2.*b.*V-b.^2);
end
% takes inputs of temperature (T ), volume (V ), critical pressure (Pc),
% critical temperature (Tc), and acentric factor (w) and returns the pressure.
SCRIPT:
% takes inputs of temperature (T ), volume (V ), critical pressure (Pc),
% critical temperature (Tc), and acentric factor (w)
% and returns the pressure.
clear; clc
T = linspace(273, 373, 100)'; %Temperature in K
Tc = [304.2 190.6 419.6];
Pc = [7.382 4.604 4.02];
w = [0.228 0.011 0,187];
V = .1*1000;
R = 8.314;
P = preos_P (V, T, Pc, Tc, w);
Ps = P;
Ts = T;
plot(Ts,Ps)
legend('carbon dioxide', 'methane', '1-butene', 'Location', 'NorthWest')
title ('[ressures of gases')

Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!