How to add unknow parameter in matrix and solve it by use det() syntax for finding w

20 views (last 30 days)
Trong Nhan Tran on 9 May 2024
Edited: john on 23 May 2024 at 11:07
% under is what i did but seen it is not work for det(A) for find w
clc % clear history command and past result
syms w;
m1 = 1.8;
m2 = 6.3;
m3 = 5.4;
m4 = 22.5;
m5 = 54;
c2 = 10000;
c3 = 500;
c4 = 1500;
c5 = 1100;
k2 = 1*10^8;
k3 = 50*10^3;
k4 = 75*10^3;
k5 = 10*10^3;
% Form of matrix is Ax=b
% Where A is nxn matrix, x is displacement of lumped masses and b is RHS.
A= [0, 0, 0, 0, (m5*w^2)-k5-c5;
0, 0, k4+c4, -k4-c4+(m4*w^2)+k5+c5, -k5+c5;
k2+c2, -k3-c3-k2-c2+(m2*w^2), k3+c3, 0, 0;
-k2-c2+(m1*w^2), k2+c2, 0, 0, 0];
det (A);
Torsten on 9 May 2024
Your matrix is 4x5. How do you want to define a determinant for it ?
Trong Nhan Tran on 9 May 2024
sry i missed one comma when typing

Hassaan on 9 May 2024
Edited: Hassaan on 9 May 2024
clc; % Clear command window
clear; % Clear workspace
syms w; % Define w as a symbolic variable
% Define masses, damping coefficients, and stiffness coefficients
m1 = 1.8; m2 = 6.3; m3 = 5.4; m4 = 22.5; m5 = 54;
c2 = 10000; c3 = 500; c4 = 1500; c5 = 1100;
k2 = 1*10^8; k3 = 50*10^3; k4 = 75*10^3; k5 = 10*10^3;
% Define the matrix A
A = [k2+c2, -k2-c2+(m2*w^2), 0, 0, 0;
-k2-c2, k2+c2+k3+c3, -k3-c3, 0, 0;
0, -k3-c3, k3+c3+k4+c4, -k4-c4+(m4*w^2), 0;
0, 0, -k4-c4, k4+c4+k5+c5, -k5-c5;
0, 0, 0, -k5, k5+c5+(m5*w^2)];
% Calculate the determinant of the matrix A
detA = det(A);
% Display the determinant
disp('The determinant of matrix A is:');
The determinant of matrix A is:
disp(detA);
double(solve(detA==0,w,'MaxDegree',3))
ans =
1.0e+02 * 0.0000 + 0.0369i 0.0000 + 1.0353i 0.0000 - 0.2352i -0.0000 - 0.0369i -0.0000 - 1.0353i -0.0000 + 0.2352i
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
• Technical Services and Consulting
• Embedded Systems | Firmware Developement | Simulations
• Electrical and Electronics Engineering
Feel free to contact me.
Sam Chak on 10 May 2024
Could you explain what the symbolic variable w is?
syms w W
% Define masses, damping coefficients, and stiffness coefficients
m1 = 1.8; m2 = 6.3; m3 = 5.4; m4 = 22.5; m5 = 54;
c2 = 10000; c3 = 500; c4 = 1500; c5 = 1100;
k2 = 1*10^8; k3 = 50*10^3; k4 = 75*10^3; k5 = 10*10^3;
% Define the matrix A
A = [k2+c2, -k2-c2+(m2*w^2), 0, 0, 0;
-k2-c2, k2+c2+k3+c3, -k3-c3, 0, 0;
0, -k3-c3, k3+c3+k4+c4, -k4-c4+(m4*w^2), 0;
0, 0, -k4-c4, k4+c4+k5+c5, -k5-c5;
0, 0, 0, -k5, k5+c5+(m5*w^2)];
% Calculate the determinant of the matrix A
detA = det(A);
detA = subs(detA, w^2, W);
% Display the determinant
disp('The determinant of matrix A is:');
The determinant of matrix A is:
disp(detA);
Wsol = double(solve(detA==0, W, 'MaxDegree', 3))
Wsol =
1.0e+04 * -0.0014 + 0.0000i -1.0718 + 0.0000i -0.0553 - 0.0000i
Torsten on 10 May 2024
I dont know why but when i use det(A) the error is Matrix must be square.
Maybe you used the 4x5 matrix you posted first.

John D'Errico on 9 May 2024
Edited: John D'Errico on 9 May 2024
syms w;
m1 = 1.8;
m2 = 6.3;
m3 = 5.4;
m4 = 22.5;
m5 = 54;
c2 = 10000;
c3 = 500;
c4 = 1500;
c5 = 1100;
k2 = 1*10^8;
k3 = 50*10^3;
k4 = 75*10^3;
k5 = 10*10^3;
% Form of matrix is Ax=b
% Where A is nxn matrix, x is displacement of lumped masses and b is RHS.
A = [k2+c2, -k2-c2+(m2*w^2), 0, 0, 0;
-k2-c2, k2+c2+k3+c3, -k3-c3, 0, 0;
0, -k3-c3, k3+c3+k4+c4, -k4-c4+(m4*w^2), 0;
0, 0, -k4-c4, k4+c4+k5+c5, -k5-c5;
0, 0, 0, -k5, k5+c5+(m5*w^2)];
A
A =
Assuming that is correctly your matrix, the result will be a degree 6 polynomial.
There can be no exact algebraic solutions fro a degree 5 or higher polynomial. But you can have numerically computed roots.
wsol =
As you can see, there were no real solutions. All solutions were purely imaginary. The real parts of those solutions are all effectively zero.

john on 22 May 2024
Edited: john on 23 May 2024 at 11:07
To add an unknown parameter in a matrix and solve it using det() syntax for an IQ brain test, replace an element with 'w.' Then, compute the determinant and solve the resulting equation for 'w.' This process allows for a more dynamic and challenging matrix calculation, enhancing the complexity of the IQ brain test.

Categories

Find more on Linear Algebra in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!