# How to get a more efficient solution for the mode shape?

With 3 degrees of freedom m, k, and w

m = {{2, 0, 0}, {0, 1.5, 0}, {0, 0, 1}};
k = {{300, -120, 0}, {-120, 180, -60}, {0, -60, 60}};
ϕ1 = {{ϕ11}, {ϕ21}, {ϕ31}};
A = k - w^2 m;
Solve[Det[A] == 0, w]


The mode shape when w = 4.59215, is given by this step

S = Flatten[A.ϕ1] /. w -> 4.59215
Q = Flatten[Solve[{S[[1]] == 0, S[[2]] == 0}, {ϕ21, ϕ31}]]
ϕ1 /. Q
ϕ1 /. Q /. ϕ11 -> 1


Is there a more efficient way to do this?

• It is not too clear what you are doing. If you give us your mass and stiffness matrix then that might help. Eigensystem is the usual approach. It gives you eigenvalues and vectors which in vibration are the natural frequencies (squared) and the mode shapes. Am I along the correct lines with your problem? – Hugh Jun 16 at 12:47
• @Hugh Thank you, Hugh. And I edited question more clearly^^ – SM KIM Jun 16 at 13:30

The mathematica formulation needs a bit of translating to get it into the standard form for vibration problems.

Starting with your mass and stiffness matrices

m = ({{2, 0, 0}, {0, 1.5, 0}, {0, 0, 1}});
k = ({{300, -120, 0}, {-120, 180, -60}, {0, -60, 60}});


We first use Eigensystem to get the eigenvalues and eigenvectors. Note that in help the example uses m anda which correspond to your k and m respectively (don't get confused).

  {vals, vecs} = Eigensystem[{k, m}];


The vals are the eigenvalues which correspond to the squared natural frequencies in radians per second. We need to take the square root to get the natural frequencies. Thus

Sqrt[vals]


{14.5779, 9.81814, 4.59215}

Which are the same as your values. We ought to include the negative values since we took the square root.

The mode shapes are given by the transpose of the eigenvectors. Thus

modes = Transpose[vecs]


{{-0.666127, 0.502056, -0.245503}, {0.694062, 0.448537, -0.527472}, {-0.273045, -0.739429, -0.813328}}

The property that you are after is that the mode shapes are orthogonal on the mass and stiffness matrices. We can check this as

Transpose[modes].k.modes


{{1.72946, 1.16573*10^-15, 5.55112*10^-16}, {8.88178*10^-16, 4.06703, 0.}, {2.77556*10^-17, -4.71845*10^-16, 0.690256}}

Transpose[modes].m.modes


{{1.68459, 3.05311*10^-16, 2.77556*10^-17}, {3.60822*10^-16, 1.35265, 1.11022*10^-16}, {2.77556*10^-17, 1.11022*10^-16, 1.19938}}

You can see that the off-diagonal terms are small and in the numerical noise. If you wish to lose these small terms then do

Transpose[modes].k.modes // Chop

{{358.002, 0, 0}, {0, 130.39, 0}, {0, 0, 25.2925}}

Transpose[modes].m.modes // Chop

{{1.68459, 0, 0}, {0, 1.35265, 0}, {0, 0, 1.19938}}

Welcome to Mathematica, I hope you enjoy doing vibration work in this language.

• Thank you very much ^^ – SM KIM Jun 16 at 22:29