Algebra equation with symbolic

1 visualización (últimos 30 días)
HYEOKJUNE LEE
HYEOKJUNE LEE el 3 de Mayo de 2018
Respondida: Walter Roberson el 3 de Mayo de 2018
Hello,
I try to solve the 4th order equation with symbolic, but the answer is not numerical numbers, see below:
My code is
m1 = 100; %kg
m2 = 10; %kg
c1 = 1;
c2 = 1;
c3 = 1;
k1 = 100;
k2 = 100;
k3 = 100;
%
M(1,1) = m1;
M(2,2) = m2
%
C(1,1) = (c1+c2);
C(1,2) = -c2;
C(2,1) = -c2;
C(2,2) = (c2+c3)
%
K(1,1) = (k1+k2);
K(1,2) = -k2;
K(2,1) = -k2;
K(2,2) = (k2+k3)
%
a0 = M(1,1)*M(2,2)
a1 = M(1,1)*C(2,2) + M(2,2)*C(1,1)
a2 = M(1,1)*K(2,2) + C(1,1)*C(2,2) + M(2,2)*K(1,1) - C(1,2)*C(2,1)
a3 = C(1,1)*K(2,2) + K(1,1)*C(2,2) - C(1,2)*K(2,1) - C(2,1)*K(1,2)
a4 = K(1,1)*K(2,2) - K(1,2)*K(2,1)
%
syms w
%
func = a0*w^4 + a1*w^3 + a2*w^2 + a3*w^1 + a4
%
wsol = solve(func,w)
then, the matlab give me a solution which format is root(σ1, z, 1). The sigma is the above function.
How can I get the solution?
Thank you.

Respuesta aceptada

John D'Errico
John D'Errico el 3 de Mayo de 2018
Editada: John D'Errico el 3 de Mayo de 2018
4 roots, all of which are complex.
vpa(wsol)
ans =
- 0.10269696007084728245763107930116 - 4.53087688516932263934459193381i
- 0.10269696007084728245763107930116 + 4.53087688516932263934459193381i
- 0.0073030399291527175423689206988387 + 1.208534091963622145606298796162i
- 0.0073030399291527175423689206988387 - 1.208534091963622145606298796162i
If you plot func, you will see that it never crosses zero.
  1 comentario
Walter Roberson
Walter Roberson el 3 de Mayo de 2018
You can also double(wsol) instead of vpa(wsol)

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 3 de Mayo de 2018
wsol = simplify(solve(func, w, 'MaxDegree', 4));
This will give you the numeric solutions, such as
((-1)^(1/4)*10^(1/4)*230339930457^(3/4)*(13099491187973 + 159912003^(1/2)*1638000000i)^(1/4)*(- 159912003^(1/2)*1638000000i - 13099491187973)^(1/6)*(2*33315^(1/2)*(- 5456997*30^(1/2)*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(1/2) - 4218680045*10^(1/2)*(8437360090 + 10*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(2/3) - 439697*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(1/3))^(1/2) - 439697*10^(1/2)*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(1/3)*(8437360090 + 10*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(2/3) - 439697*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(1/3))^(1/2) - 5*10^(1/2)*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(2/3)*(8437360090 + 10*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(2/3) - 439697*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(1/3))^(1/2))^(1/2) + 10^(3/4)*2221^(1/2)*(33*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(1/6)*(8437360090 + 10*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(2/3) - 439697*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(1/3))^(1/4) + 3^(1/2)*(8437360090 + 10*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(2/3) - 439697*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(1/3))^(3/4)))*(159912003^(1/2)*8793940000000i + 10*(293032087997 + 159912003^(1/2)*20000000i)*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(1/3) + 133040111*(- 13099491187973 + 159912003^(1/2)*1638000000i)^(2/3) + 16594597703959910)^(1/4)*1i)/7769568131425052256545514000
You should consider whether you actually want the numeric solutions, or if you want approximate results instead, such as the ones John showed.
If what you want is the approximate results then:
wsol_approx = vpasolve(func);

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by