How to fix the sym/solve error
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Paul
le 26 Oct 2021
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!