Finite Element Analysis for Fixed Ended Beam with a Point Load example: I am getting this error: Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the se

11 views (last 30 days)
Fixed Ended Beam with Point Load Example
%Data
E = 2.1E5; % N/mm^2
L = 6000; % length in mm
I = 78E6; % mm^4
Elemental Stiffness Matrix
Const = (E*I)/(L^3);
%Since we only have one element this is the overall
%stiffness matrix
KE1 = [12 6*L -12 6*L;
6*L 4*L^2 -6*L 2*L^2;
-12 -6*L 12 -6*L;
6*L 2*L^2 -6*L 4*L^2];
KE1 = Const*KE1;
Solution
K = KE1;
KT = K;
KT(:,1) = 0;
KT(1,:) = 0;
KT(1,1) = 1;
KT(:,2) = 0;
KT(2,:) = 0;
KT(2,2) = 1;
KT(:,4) = 0;
KT(4,:) = 0;
KT(4,4) = 1;
KT(:,5) = 0;
KT(5,:) = 0;
KT(5,5) = 1;
KT(:,6) = 0;
KT(6,:) = 0;
KT(6,6) = 1;
KT
FT = [0;0; -50;0; 0;0];
d = inv(KT)*FT
F = K*d

Answers (1)

Divyajyoti Nayak
Divyajyoti Nayak on 29 Jan 2025 at 9:39
The error in your code is caused because the dimensions of the matrices ‘K’ (4X4) and ‘d’ (6X1) are not suitable for matrix multiplication. The dimensions of these vectors are visible in the Workspace.
It is mentioned that only one element is considered so there should be 2 nodes with 2 degrees of freedom in the finite element analysis. But the stiffness matrix used ‘KT’ and the nodal displacements ‘d’ have 6 rows which imply 3 nodes, so that is likely the cause of the miscalculation.

Categories

Find more on MATLAB 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!