Solving Complex Equations Using MATLAB

2 次查看(过去 30 天)
I am having trouble solving complex equations using the solve command. There are 3 variables I am solving for and I have 2 equations to solve for them but matlab is not able to simplify the equations down to solve for the missing variables. I am also trying to get a graph to display these relations when it is complete. I am trying to solve for L and D in terms of n.
clear;
syms D n L
%density
p=1000;
%Specific Heat
Cp=4182;
k=0.598;
Pr=7.01;
%dynamic visc
m=1.002e-3;
%pressure drop
dP=5000;
%mass flow rate
m_dot=23.9234;
%Cmin
C_min=32258.1;
%UA
UA=125634;
%Reynold's Number
Re=38399.4*(1/(n*D));
%Friction Factor
f=(0.79*log(Re)-1.64)^-2;
%Pressure Drop Relation
%eqn1 = 5000==f*((16*m_dot^2*L)/(p*pi^2*D^4))*(1/(2*D))
h = Cp*((4*m_dot)/(n*pi*D^2))*(1/2)*f*Pr^(-2/3)
eqn1 = UA==h*n*pi*D*L
L = solve(eqn1,L)
simplify(L)
disp(L)
eqn2 = 5000==f*((16*m_dot^2*L)/(p*pi^2*D^4))*(1/(2*D))
%this only displays a number equal to D, I want it in terms of n but n is
%not in the equation
D = solve(eqn2,D,"Real",true)

回答(1 个)

Walter Roberson
Walter Roberson 2023-3-14
Q = @(v) sym(v);
Pi = Q(pi);
syms D n L
%density
p = Q(1000);
%Specific Heat
Cp = Q(4182);
k = Q(598)/Q(10)^3;
Pr = Q(701) / Q(10)^2;
%dynamic visc
m = Q(1002)/Q(10)^6;
%pressure drop
dP = Q(5000);
%mass flow rate
m_dot = Q(239234)/Q(10)^4;
%Cmin
C_min = Q(322581)/Q(10)^1;
%UA
UA = Q(125634);
%Reynold's Number
Re = Q(383994)/Q(10)^1*(1/(n*D));
%Friction Factor
f = simplify((Q(79)/Q(10)^2*log(Re)-Q(164)/Q(10)^2)^-2)
f = 
%Pressure Drop Relation
%eqn1 = 5000==f*((16*m_dot^2*L)/(p*pi^2*D^4))*(1/(2*D))
h = simplify(Cp*((Q(4)*m_dot)/(n*Pi*D^2))*(Q(1)/Q(2))*f*Pr^(Q(-2)/Q(3)))
h = 
Notice that if you take the denominator of f, the term involving log(n), and multiply the two parts by 100, that the expression becomes the same as the 79*log(191997/(5*D*n)) - 164 that shows up in h. So later in the calculations those two log terms cancel, leaving only a fraction.

类别

Help CenterFile Exchange 中查找有关 Equation Solving 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by