equation solver solve() returns empty result
이전 댓글 표시
I tried using symbolic equation solver to get the results
syms V a b K
eq1 = pi^2*(a+b).*(b-a).^2 == V
eq2 = V == 8000
eq3 = a == K*b
eq4 = K == 0.2:0.1:0.7
a = solve([eq1,eq2,eq3,eq4],a)
And I got
a =
Empty sym: 0-by-1
It should have solutions while it returned nothing. Did I have something wrong?
댓글 수: 3
madhan ravi
2019년 2월 2일
why not solve the first three equations and substitute K values?
kairui wang
2019년 2월 2일
Walter Roberson
2019년 2월 2일
편집: Walter Roberson
2019년 2월 2일
eq4 = K == 0.2:0.1:0.7
defines a system of 6 equations,
[ K == 1/5, K == 3/10, K == 2/5, K == 1/2, K == 3/5, K == 7/10]
all of which have to be true simultaneously in order for solve() to find a solution.
You need to use symbolic K and substitute in the values later -- or you need to loop with specific numeric K values.
Also, you must solve() for as many variables as your provide equations. With four equations, you need to solve for four variables simultaneously. If you look at the solution I provided, I provide two equations and I solve for two variables.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Numeric Solvers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!