LIN1 Solved
LIN1 Solved
Systems of linear equations are very important in applied and numerical mathematics. Since engineers are
dealing mostly with linear models, this requires solving systems of linear equations in engineering problems.
Consider a problem in statics. Let us analyze the forces on a truss with equilateral triangles as shown on the
figure below.
Compute member forces by the method of joints. Make the following approximations: and
( and ).
Equations of equilibrium of rectangular components of forces and moments are used to determine reactions
at supports ( , , ). The following system of linear equations can be formulated by considering forces at
nodes, where represent tension in members:
In general form:
1
Existence and uniqueness of solution
The system of equations can be inhomogeneous (b ≠ 0) or homogeneous (b = 0). When the system is
homogeneous, we have a nontrivial solution (x ≠ 0) only if the determinant of A is zero: det(A)=0.
2
The solution is unique, if r(A)=r(A|b)=n or det(A) ≠ 0, that is rank of matrix A is equal to the rank of the
augmented matrix and this rank is full (equals to the number of columns).
Ab=[0.500000000000000,1,0,0,0,0,0,1000;...
0.866000000000000,0,0,0,0,0,0,-2067;...
-0.500000000000000,0,0.500000000000000,1,0,0,0,-1000;...
0.866000000000000,0,0.866000000000000,0,0,0,0,0;...
0,-1,-0.500000000000000,0,0.500000000000000,1,0,0;...
0,0,0.866000000000000,0,0.866000000000000,0,0,5000;...
0,0,0,-1,-0.500000000000000,0,0.500000000000000,0];
% Ab = load('truss.txt')
A = Ab(:,1:end-1)
b = Ab(:,end)
Check our solutions by computing the length (norm - function norm) of the residual vector if it is zero or is
within the required tolerance.
norm(A*x1-b) % 1.0904e-12
norm(A*x2-b) % 5.5695e-13
norm(A*x3-b) % 5.1348e-12
norm(A*x4-b) % 6.0157e-13
Matrix decompositions
3
.
Matlab will produce an LU decomposition with pivoting for a matrix Aa with the following command:
[L U P] = lu(A)
To solve we first multiply both sides with the permutation (pivot) matrix:
Then we define , which is unknown since x is unknown. Using forward substitution, we can (easily)
solve
[L U P] = lu(A)
d = P*b;
opt1.LT=true
y = linsolve(L,d,opt1);
opt2.UT=true
x = linsolve(U,y,opt2)
residual = norm(A*x - b) % check
Cholesky decomposition
Cholesky decomposition is very similar to LU decomposition: .
Conditions:
norm(A-A') % 1.5946
4
real(eig(A)) % [0.5000; -0.7136; -0.7136; -0.7136; 1.2136; 1.2136; 1.2136]
%chol(A) % issues an error message: Matrix must be positive definite
Solution of a linear system is similar to LU decomposition (there is no permutation, hence instead of d we put
vector b, put L' in place of L and put L in place of U):
opt1.LT=true
y = linsolve(L',b,opt1);
opt2.UT=true
x = linsolve(L,y,opt2)
residual = norm(A*x - b) % check