# Get "Matrix is is singular to working precision" when attempting a global stiffness matrix with four nodes

1 visualizzazione (ultimi 30 giorni)
Declan Kelly il 22 Feb 2023
Commentato: Declan Kelly il 22 Feb 2023
% initialise Globgal Stiffness Matrix Using Zeros In A 4X4 Grid
K = zeros(4);
% define Stiffness Constants [lbf/in]
k1 = 1000;
k2 = 2000;
k3 = 3000;
% define Applied Forces [lbf]
f2 = -500;
f4 = 1000;
% set-Up Structural Matrix In A 2X2 Grid
% between Nodes 1 & 2
ks = k1*[1 -1;-1 1];
K(1:2,1:2) = K(1:2,1:2) + ks;
% between Nodes 2 & 3
ks = k2*[1 -1;-1 1];
K(2:3,2:3) = K(2:3,2:3) + ks;
% between Nodes 3 & 4
ks = k3*[1 -1;-1 1];
K(3:4,3:4) = K(3:4,3:4) + ks;
% columnise Forces
f = [0;f2;0
I understand I haven't initialised f3 yet but I am not too sure how. My main issue is regarding the error I get when I run it. That being: "Matrix is singular to working precision". This is a four node spring assembly and I am required to find the global stiffness matrix and subsequently the displacement of the springs from node 1.
;f4];
Unrecognized function or variable 'f3'.
% columnise Displacement
d = zeros(4,1)
% initialise Range Variable
range = (2:4)
% solve
d(range) = k(range,range)\f(range)
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

David Goodmanson il 22 Feb 2023
Modificato: David Goodmanson il 22 Feb 2023
Hi Declan,
I am not sure how you are getting the error message. Running the code with k changed to K
d(range) = K(range,range)\f(range)
gives
d =
0
0.5000
1.0000
1.3333
which is correct. You can keep f3 = 0 since f represents external forces and there is no external force on node 3.
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Declan Kelly il 22 Feb 2023
Thank you very much! I must have missed that little typo. Cheers

Accedi per commentare.

### Categorie

Scopri di più su Assembly in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by