Return a specific solution vpasolve
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Ameer Hamza
2020년 5월 1일
편집: Ameer Hamza
2020년 5월 1일
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!