Solving a two-variable function for a given range of one variable

조회 수: 18 (최근 30일)
cmcelm
cmcelm 2019년 11월 1일
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개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by