Using vpasolve to iterate/solve for flowrate in a piping network

조회 수: 3 (최근 30일)
Jonathan Siow
Jonathan Siow 2020년 5월 19일
답변: Alex Sha 2020년 5월 20일
Dear Matlab community,
I am trying to use vpasolve to solve for the Fanning friction factor (f1), Reynolds number (Re1), and velocity (v1) of water flowing through a single pipe with the following code:
>> syms f1 v1 Re1 %% not sure why 'f1' isn't in pink font on this post, it is pink on my computer
eqn1 = 14.63 == ((f1*(3200/0.3))+6.8)*((v1^2)/(2*9.81));
eqn2 = Re1 == v1*0.3/(1.004E-6);
eqn3 = 1/(f1^0.5) == -2*log(((1.5e-6)/(3.7*0.3))+(2.51/(Re1*(f1^0.5))));
sol = vpasolve(eqn1,eqn2,eqn3, f1, v1, Re1);
sol.f1
sol.v1
sol.Re1
However, matlab returns:
ans =
Empty sym: 0-by-1
ans =
Empty sym: 0-by-1
ans =
Empty sym: 0-by-1
>> double(sol.Re1)
ans =
0×1 empty double column vector
I have tried iterating using the Goal Seek function on Excel by first typing in a suggested a Reynolds number.
By suggesting a Re number, excel will iterate to find a value for 'f1' that ensures LHS - RHS = 0
eqn3 = 1/(f1^0.5) == -2*log(((1.5e-6)/(3.7*0.3))+(2.51/(Re1*(f1^0.5))));
What is preventing the matlab code from successfully iterating?
I am trying to solve this simpler example first because I will later be trying this on a more complicated pipe network with several Fanning friction values, Reynolds numbers, velocities, etc.
I have read the vpasolve matlab help page and am still stuck.
Any help appreciated!
Thanks,
Jonathan

답변 (1개)

Alex Sha
Alex Sha 2020년 5월 20일
refer to the result below:
f1: 0.013713131883721
v1: 1.36937309476078
re1: 409175.227518161

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by