Solving a two-variable function for a given range of one variable
21 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all,
I have a problem where I have a function P(V, T) of two variables. I would like to solve the function for a constant P and a range of T to return the corresponding V values as an array. I then need to take that V array and plug it into further functions of V and T.
So far, my code is just returning errors. Can anyone help with this?
syms T V
Tc = 227.5;
Pc = 3745000;
R = 8.3145;
a = (27*(R^2)*(Tc^2))/(64*Pc);
b = (R*Tc)/(8*Pc);
P = ((R*T)/(V-b))-(a/(V^2));
vdW = matlabFunction(P);
dPdT = diff(vdW, T)
dPdV = diff(vdW, V)
alpha = (-1/V)*(dPdT/dPdV)
expand = matlabFunction(alpha)
kappat = -1/(V*dPdV)
compress = matlabFunction(kappat)
CpCvdiff = T*V*((alpha^2)/kappat)
Trange = [89.4:10:1.5*Tc]
%to solve for V
Vrange = vpasolve(vdW(V, Trange) == Pc, V, [0 inf])
%to find alpha
expandrange = expand(Vrange, Trange)
%and so on for kappa and cp/cv
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Numerical Integration and Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!