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

1 view (last 30 days)
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);
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!

Answers (1)

Alex Sha
Alex Sha on 20 May 2020
refer to the result below:
f1: 0.013713131883721
v1: 1.36937309476078
re1: 409175.227518161


Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!