Solving a quartic with matlab
Afficher commentaires plus anciens
Hi, I'm new to matlab and im struggling to solve a quartic equation with 4 variables, so far ive got this:
clear
g=9.81;
h=10;
u=1;
d=0.5;
c=0.5;
a=u./sqrt(g.*h)
syms a b c d
solve(((a^(2)*b^4)/2)+2*c*a^(2)*b^(3)-(2-2*d+a^(2))*b^(2)-(4*c+2*c*a^(2)-4)*b+((a^(2)/2)+4*c-2*c^(2)*d-2),b)
which gives me the answer:
a =
0.1010
ans =
RootOf(a^2*z^4 + 4*a^2*c*z^3 - 2*a^2*z^2 + 4*d*z^2 - 4*z^2 - 4*a^2*c*z - 8*c*z + 8*z - 4*c^2*d + 8*c + a^2 - 4, z)
the value for a is what I expected, however I expected 4 real numbers for my value for b. Can you offer any help interpreting this answer?
Thanks Joshua
Réponses (1)
Paul
le 2 Mar 2014
0 votes
Matlab will solve up to a 3rd order polynomial by default. To get an explicit result you have to specify a max degree, in your case 4. See: http://www.mathworks.nl/help/symbolic/solve.html
So:
solve(((a^(2)*b^4)/2)+2*c*a^(2)*b^(3)-(2-2*d+a^(2))*b^(2)-(4*c+2*c*a^(2)-4)*b+((a^(2)/2)+4*c-2*c^(2)*d-2),b, 'MaxDegree', 4)
Catégories
En savoir plus sur Symbolic Math Toolbox dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!