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