Return a specific solution vpasolve
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Brian Robinson
am 1 Mai 2020
Bearbeitet: Ameer Hamza
am 1 Mai 2020
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
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 1 Mai 2020
Bearbeitet: Ameer Hamza
am 1 Mai 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.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Conversion Between Symbolic and Numeric finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!