symbolic equation Empty sym: 0-by-1
Afficher commentaires plus anciens
here's the command line instruction I issue:-
solve('xw = xo+sin(xo)*180/pi',xo)
but I get:- ans = Empty sym: 0-by-1
I'm obviously new to Matlab...any help appreciated..Thanks
5 commentaires
Walter Roberson
le 18 Mar 2018
Are you certain that you should be multiplying the results of the sin() by 180/π ? That is the factor that you would use to convert radians to degrees, but the results of sin() are not in radians.
george brown
le 18 Mar 2018
Walter Roberson
le 18 Mar 2018
The equation cannot be correct. sin(xo) implies that xo is in radians. You can clear the factor of 180/π on the sin() term by multiplying all terms by π/180. When you do that then the xo+ term becomes xo*π/180+ which would be the conversion if xo were in degrees and you wanted to convert to radians. But if that were the case then you would not use sin(xo) because sin() is not applied to degrees.
Either you have the wrong conversion factor or else you should be using sind()
It would help if you were to indicate the expected units for your variables.
Walter Roberson
le 18 Mar 2018
When I test your equation with xw arbitrarily set to sqrt(2) or 10, I find 36 or 38 real solutions: which one did you need?
george brown
le 19 Mar 2018
Réponses (2)
John D'Errico
le 18 Mar 2018
Modifié(e) : John D'Errico
le 18 Mar 2018
0 votes
Being new is irrelevant. This is just a question of mathematics. Sym produces an empty result because there is no analytical solution to the problem posed. It is trivially simple to write an expression with no analytical solution. You just proved that by example.
If you have a specific value for xw, then use a tool like fzero or vpasolve, that will be able to provide a numerical root finding solution. Even there, you may need to beware, because there may be still no solution, or there may be multiple solutions, and the rootfinder will only provide a single solution. In the latter case, it will depend on the starting point for the solver.
1 commentaire
george brown
le 18 Mar 2018
qasem qasem
le 10 Août 2020
here's the command line instruction I issue:-
syms a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18...
a19 a20
eqn0=-2*(-(e*a0)-x2*a1-x3*a2-x2*a3-x3*a4-x4*a5-x5*a6-x2*a7-x3*a8-x4*a9-...
x5*a10-x6*a11-x7*a12-x2*a13-x3*a14-x4*a15-x5*a16-x6*a17-x7*a18-x8*a19...
-x9*a20)==2*x1;
eqn1=-2*(-x2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a7-ii3*a8-ii4*a9-...
ii5*a10-ii6*a11-ii7*a12-ii2*a13-ii3*a14-ii4*a15-ii5*a16-ii6*a17-ii7*a18-ii8*a19...
-ii9*a20)==2*ii1;
eqn20=-2*(-x9*a0-oo2*a1-oo3*a2-oo2*a3-oo3*a4-oo4*a5-oo5*a6-oo2*a7-oo3*a8-oo4*a9-...
oo5*a10-oo6*a11-oo7*a12-oo2*a13-oo3*a14-oo4*a15-oo5*a16-oo6*a17-oo7*a18-oo8*a19...
-oo9*a20)==2*oo1;
sol = solve(eqn0, eqn1, eqn2, eqn3, eqn4, eqn5, eqn6, eqn7, eqn8,...
eqn9, eqn10, eqn11, eqn12, eqn13, eqn14, eqn15, eqn16, eqn17, eqn18, eqn19, eqn20)
a0sol=double(sol.a0)
a1sol=double(sol.a1)
a2sol=double(sol.a2 )
a3sol=double(sol.a3 )
a4sol=double(sol.a4)
a5sol=double(sol.a5)
a6sol=double(sol.a6)
a7sol=double(sol.a7)
a8sol=double(sol.a8)
a9sol=double(sol.a9 )
a10sol=double(sol.a10 )
a11sol=double(sol.a11)
a12sol=double(sol.a12)
a13sol=double(sol.a13 )
a14sol=double(sol.a14 )
a15sol=double(sol.a15 )
a16sol=double(sol.a16)
a17sol=double(sol.a17)
a18sol=double(sol.a18)
a19sol=double(sol.a19)
a20sol=double(sol.a20)
but I get:- ans = Empty sym: 0-by-1
I'm obviously new to Matlab...any help appreciated..Thanks
1 commentaire
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
