Solving a quartic with matlab

43 次查看(过去 30 天)
Joshua
Joshua 2014-3-2
回答: Paul 2014-3-2
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

回答(1 个)

Paul
Paul 2014-3-2
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)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by