Return a specific solution vpasolve

1 view (last 30 days)
Hello there,
For the following code:
Q = 4.3; s_0 = 0.003; n = 0.025; L = 30; k_e = 0.5; C_D = 0.65; H = 3.6; g = 9.81;
syms D deltaH
A = pi*D^2/4;
V = Q/A
R_H = D/4;
eqn1 = deltaH == H - D + L*s_0
eqn2 = deltaH == (k_e + (2*g*n^2*L)/(R_H^(4/3)) + 1)*((Q^2)/(2*g*A^2))
[deltaH, D] = vpasolve(eqn1 == eqn2, [deltaH, D],3.5)
Solving this gives the wrong solution. When we graph the two equations, we can see that there are two solutions. I want to return the first solution and hence I have used the initial guess of 3.5, however vpasolve still gives the other solution.
How can I get the first solution i.e. 1<D<1.5 ?
Thanks,
Brian

Accepted Answer

Ameer Hamza
Ameer Hamza on 1 May 2020
Edited: Ameer Hamza on 1 May 2020
Try this
sol = vpasolve([eqn1, eqn2], [deltaH, D], [0 1.25]) % give two values for initial guess, for [delhaH D]
%^ use comma. Using == in this context is incorrect.

More Answers (0)

Categories

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

Tags

Community Treasure Hunt

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

Start Hunting!