Matrix must be square error and Error in PartA. how do I solve it?
2 views (last 30 days)
Show older comments
Trong Nhan Tran
on 10 May 2024
Answered: Avni Agrawal
on 10 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;
B = [k2+c2, -k2-c2+(m2*w^2), 0, 0, 0;
-k2-c2, k2+c2+k3+c3, -k3-c3, 0, 0];
detB = det(B);
Error using sym/det (line 24)
Matrix must be square.
Error in PartA (line 23)
detB = det(B);
0 Comments
Accepted Answer
Avni Agrawal
on 10 May 2024
I understand that you are trying to find the determinant of matrix B. But, The determinant is a scalar value that can be computed from the elements of a square matrix and encodes certain properties of the matrix. For a non-square matrix, since the number of rows and columns is different, the concept of a determinant does not apply.
Please take a look at this documentation for better understanding: https://www.mathworks.com/help/matlab/ref/det.html
I hope this helps.
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing 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!