How to fix the sym/solve error
조회 수: 3 (최근 30일)
이전 댓글 표시
I get the following error from my code:
z = [-6.41 -12.4 2.143 102];
r = [13.58 15.7636 12.96 46.6];
syms A B C D;
eq1 = A*r(1)^2+B*z(1)+C*r(1)+D ==0;
eq2 = A*r(2)^2+B*z(2)+C*r(2)+D ==0;
eq3 = A*r(3)^2+B*z(3)+C*r(3)+D ==0;
eq4 = A*r(4)^2+B*z(4)+C*r(4)+D ==0;
solve([eq1,eq2,eq3,eq4],[A,B,C,D])
>> solve([eq1,eq2,eq3,eq4],[A,B,C,D])
Error using sym/solve (line 89)
Error using maplemex
Error, (in MTM:-solve) Vector[row](4, [0,0,0,0], datatype = integer[1]) is not valid equation or expression
And when I tried to display the path of the symbolic solve, here is the result:
>> which -all solve
D:\Softwares\toolbox\maple\solve.m
D:\Softwares\toolbox\maple\@sym\solve.m % sym method
D:\Softwares\toolbox\symbolic\symbolic\@sym\solve.m % sym method
How should I fix this issue?
댓글 수: 0
채택된 답변
Paul
2021년 10월 26일
What version are you using? Seems to work ok here, but w/o any references to Maple.
which -all solve
z = [-6.41 -12.4 2.143 102];
r = [13.58 15.7636 12.96 46.6];
syms A B C D;
eq1 = A*r(1)^2+B*z(1)+C*r(1)+D ==0;
eq2 = A*r(2)^2+B*z(2)+C*r(2)+D ==0;
eq3 = A*r(3)^2+B*z(3)+C*r(3)+D ==0;
eq4 = A*r(4)^2+B*z(4)+C*r(4)+D ==0;
sol = solve([eq1,eq2,eq3,eq4],[A,B,C,D])
By inspection, we see that solve returned the trivial solution. We can also verify it's the only solution
M = [r(:).^2 z(:) r(:) ones(4,1)];
null(M)
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!