Why is this assignment displaying an error?
Show older comments
Hello,
I am wondering why I am getting this display error. I have written another script using the same matrix, it's just a smaller square matrix. Can anyone help me in having this script run correctly. In the attachments is a snip picture of what I am seeing in the command window.
%%If 10 elements are used
E = 30*10^6;
L_0 = 6;
F = 300;
SLOPE = -1/12;
D = @(x) (SLOPE*x)+1; % This is the function of Diameter
A = @(x) (pi/4)*(D(x)^2); % This is the function of Area
L_10 = L_0/10;
k1 = (A(L_10)*E)/L_10;
k2 = (A(2*L_10)*E)/L_10;
k3 = (A(3*L_10)*E)/L_10;
k4 = (A(4*L_10)*E)/L_10;
k5 = (A(5*L_10)*E)/L_10;
k6 = (A(6*L_10)*E)/L_10;
k7 = (A(7*L_10)*E)/L_10;
% This is the Global Stiffness Matrix
K = [k1, -k1, 0, 0, 0, 0, 0, 0, 0, 0, 0;
-k1, k1+k2, -k2, 0, 0, 0, 0, 0, 0, 0, 0;
0, -k2, k2+k3, -k3, 0, 0, 0, 0, 0, 0, 0;
0, 0, -k3, k3+k4, -k4, 0, 0, 0, 0, 0, 0;
0, 0, 0, -k4, k4+k5, -k5, 0, 0, 0, 0, 0;
0, 0, 0, 0, -k5, k5+k6, -k6, 0, 0, 0, 0;
0, 0, 0, 0, 0, -k6, k6+k7, -k7, 0, 0, 0;
0, 0, 0, 0, 0, 0, -k7, k7+k8, -k8, 0, 0;
0, 0, 0, 0, 0, 0, 0, -k8, k8+k9, -k9, 0;
0, 0, 0, 0, 0, 0, 0, 0, -k9, k9+k10, -k10;
0, 0, 0, 0, 0, 0, 0, 0, 0, -k10, k10;
% This is the Global Stiffness Matrix
Stiffness = [ k1+k2, -k2, 0, 0, 0, 0, 0, 0, 0, 0;
-k2, k2+k3, -k3, 0, 0, 0, 0, 0, 0, 0;
0, -k3, k3+k4, -k4, 0, 0, 0, 0, 0, 0;
0, 0, -k4, k4+k5, -k5, 0, 0, 0, 0, 0;
0, 0, 0, -k5, k5+k6, -k6, 0, 0, 0, 0;
0, 0, 0, 0, -k6, k6+k7, -k7, 0, 0, 0;
0, 0, 0, 0, 0, -k7, k7+k8, -k8, 0, 0;
0, 0, 0, 0, 0, 0, -k8, k8+k9, -k9, 0;
0, 0, 0, 0, 0, 0, 0, -k9, k9+k10, -k10;
0, 0, 0, 0, 0, 0, 0, 0, -k10, k10;
F = [0;0;0;0;0;0;0;0;0;300];
U = inv(K2)*F
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices 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!