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 Center および File ExchangeSolver 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