TransWikia.com

Help in solve the matrix

Mathematica Asked by Scott Constantine on March 1, 2021

I have written the following code. I have two main problems. The first is how to solve the matrix for different Omega, and the second is that if I put letters instead of numbers for k or m, the values will not add up(plus).

Subscript[k, 1] = K;
Subscript[k, 2] = K;
Subscript[k, 3] = K;
Subscript[m, 1] =M;
Subscript[m, 2] = 2*M;
Subscript[m, 3] = 2*M;
n = 3;
Format[m[n_]] := Subscript[m, n];
mv = Array[m, n];
(mm = (mv) IdentityMatrix[n]) // MatrixForm
Format[k[n_]] := Subscript[k, n];
kv = Array[k, n];
(kk = (kv + Join[Rest[kv], {0}]) IdentityMatrix[n] + 
    DiagonalMatrix[-Rest[kv], 1] + 
    DiagonalMatrix[-Rest[kv], -1]) // MatrixForm
(Omega = Solve[Det[kk - mm*[Omega]] == 0, [Omega]]) // N
(Time = 2 Pi/Sqrt[Omega] // RootReduce) // N
(mA = kk - mm*Omega[[i]] // RootReduce);
mC = {0, 0};
mX = Array[[Phi], 2];
eqn = mA.mX == mC;
sol = Solve[eqn, mX]
(sol = (SolveAlways[eqn, mX])) // N

And how to get the answer in the form of a matrix as shown below

n = 3
Table[Subscript[[CapitalPhi], i, j], {i, n}, {j, n}];
MatrixForm[%]

I thought maybe it would help, the top matrix is a modal matrix for structural modes
enter image description here

In the book it is mentioned that for each Omega there is a Phi vector which is known as the special vector or the characteristic vector, also elsewhere the unit value is considered for the component related to the first class.

One Answer

Clear["Global`*"]

k[1] = 4000;
k[2] = 4000;
k[3] = 5000;
m[1] = 10;
m[2] = 2;
m[3] = 5;
n = 3;

mv = m /@ Range[n];
mm = (mv) IdentityMatrix[n];
kv = k /@ Range[n];

(kk = (kv + Join[Rest[kv], {0}]) IdentityMatrix[n] + 
    DiagonalMatrix[-Rest[kv], 1] + DiagonalMatrix[-Rest[kv], -1]);

(Omega = ω /. Solve[Det[kk - mm*ω] == 0, ω]) // N

(* {177.181, 857.532, 5265.29} *)

(Time = 2 Pi/Sqrt[Omega] // RootReduce) // N

(* {0.472032, 0.214563, 0.0865902} *)

(mA = Table[kk - mm*Omega[[i]], {i, n}] // RootReduce);

mC = ConstantArray[0, n];

Format[ϕ[n_]] := Subscript[ϕ, n];

mX = Array[ϕ, n];

eqns = Table[mA[[i]].mX == mC, {i, n}];

(sol = Solve[#, mX] & /@ eqns // RootReduce // Quiet) /. x_Root :> N[x]

enter image description here

The solution gives ϕ[2] and ϕ[3] in terms of ϕ[1]. If instead you want ϕ[1] and ϕ[2] in terms of ϕ[3],

(sol2 = Solve[#, Most@mX, MaxExtraConditions -> All] & /@ eqns // RootReduce //
     Quiet) /. x_Root :> N[x]

enter image description here

I do not understand the relation of the results to the pictures that you show.

EDIT: Using symbolic values

Clear["Global`*"]

k[1] = K;
k[2] = K;
k[3] = K;
m[1] = M;
m[2] = 2*M;
m[3] = 2*M;
n = 3;

mv = Array[m, n];
(mm = (mv) IdentityMatrix[n]) // MatrixForm;

kv = Array[k, n];
(kk = (kv + Join[Rest[kv], {0}]) IdentityMatrix[n] + 
     DiagonalMatrix[-Rest[kv], 1] + DiagonalMatrix[-Rest[kv], -1]) // 
  MatrixForm;

(Omega = ω /. Solve[Det[kk - mm*ω] == 0, ω])

(* {K/M, (5 K - Sqrt[21] K)/(4 M), (5 K + Sqrt[21] K)/(4 M)} *)

Time = 2 Pi/Sqrt[Omega];

mA = Table[kk - mm*Omega[[i]], {i, n}];

mC = ConstantArray[0, n];

Format[ϕ[m_, n_]] := Subscript[ϕ, m, n]

mX = Array[ϕ, {n, n}];

eqn = Table[mA[[i]].mX[[i]] == mC, {i, n}];

sol = Table[Solve[eqn[[i]], mX[[i]]], {i, n}] // Quiet

enter image description here

Answered by Bob Hanlon on March 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP