Matrix is singular to working precision.
26 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm getting the error "Matrix is singular to working precision." I'm not sure what is wrong with my code but I need to not get zeros for my Total Stiffness Matrix, Nodal Forces, and Nodal Dispalcements. What should I do?
E = 200e9 * ones(2,1);
L = 2 * ones(2,1);
I = 3e-4 * ones(2,1);
kb = E.*I./L.^3;
q = 2e3; %---Positive for -y direction
f0 = q*[-L(2)/2;-L(2)^2/12;-L(2)/2;L(2)^2/12];
K = beam_stiffness(kb,L);
K(4:6,4:6)
d_part = K(4:6,4:6)\f0(2:end);
d = [0;0;0;d_part];
f_eff = K * d;
f = f_eff - [0;0;-q*L(2)/2;-q*L(2)^2/12;-q*L(2)/2;q*L(2)^2/12];
t = zeros(size(L));
for cnt=1:length(L)
n{cnt} (1) = cnt;
n{cnt} (2) = cnt + 1;
end
function result = beam_stiffness(kb,l)
if ~(length(kb)==length(l))
error('Base stiffness and length arrays must have equal number of elements.');
end
num_elem = length(kb);
num_node = num_elem + 1;
ke = zeros(4,4,length(kb));
for cnt=1:num_elem
ke(:,:,cnt) = kb(cnt) * [12 6*l(cnt) -12 6*l(cnt);
6*l(cnt) 4*l(cnt)^2 -6*l(cnt) 2*l(cnt)^2;
-12 -6*l(cnt) 12 -6*l(cnt);
6*l(cnt) 2*l(cnt)^2 -6*l(cnt) 4*l(cnt)^2];
end
K = zeros(2*num_node,2*num_node);
for cnt=1:num_elem
K(2*cnt-1:2*cnt+2,2*cnt-1:2*cnt+2) - K(2*cnt-1:2*cnt+2,2*cnt-1:2*cnt+2) + ...
ke(:,:,cnt);
end
result = K;
end
0 Kommentare
Antworten (1)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!