Matrix must be square error and Error in PartA. how do I solve it?

1 次查看(过去 30 天)
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);

采纳的回答

Avni Agrawal
Avni Agrawal 2024-5-10
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 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by