Chapter 8 Linear Algebraic Equations and Matrices
Three individuals connected by bungee cords
Free-body diagrams Newton’s second law Rearrange the equations [K] {x} = {b}
Newton’s second law – equation of motion Kirchhoff’s current and voltage rules Mass-spring system (similar to bungee jumpers) Resistor circuits
zSolved single equations previously zNow consider more than one variable and more than one equation Linear Algebraic Equations
zLinear equations and constant coefficients za ij and b i are constants Linear Systems Linear Systems
Forces on a Truss zMost obvious example in Civil Engineering ztrusses: force balance at joints F1F1 F2F2 F3F3 R
Mathematical background zIt is convenient to write system of equations in matrix-vector form
Matrix Notations Column 4 Row 3 (second index) (first index)
Scalars, Vectors, Matrices zMATLAB treat variables as “matrices” zMatrix (m n) - a set of numbers arranged in rows (m) and columns (n) zScalar : 1 1 matrix zRow Vector : 1 n matrix ( [b] or b ) zColumn Vector : m 1 matrix ( [c] or {c} )
z Square matrix, m = n zParticularly important when solving simultaneous equations in engineering applications za ii – principle or main diagonal Square Matrix
z Transpose zIn MATLAB, transpose is A zTrace is sum of diagonal elements zIn MATLAB, trace(A) Matrix Operations
Matrix Transpose
symmetric matrices Special Matrices a ij = a ji [A] T = [A]
Diagonal matrix Identity matrix Special Matrices [A][I] = [I][A] = [A]
Banded matrix – all elements are zero, with the exception of a band centered on the main diagonal Special Matrices Tridiagonal – three non-zero bands
lower triangular upper triangular Special Matrices
Matrix Operation Rules zMatrix identity [A] = [B] if and only if a ij = b ij for all i and j zMatrix Addition and Subtraction [C] = [A] + [B] C ij = A ij + B ij [C] = [A] [B] C ij = A ij B ij
Addition and Subtraction zCommutative [A] + [B] = [B] + [A] [A] [B] = [B] + [A] zAssociative ( [A] + [B] ) + [C] = [A] + ( [B] + [C] ) ( [A] + [B] ) [C] = [A] + ( [B] [C] ) ( [A] [B] ) + [C] = [A] + ( [B] + [C] )
Multiplication of Matrix by a Scalar g = 5
Visual depiction of how the rows and columns line up in matrix multiplication Matrix Multiplication
Matrix Multiplications zRecall how matrix multiplication works [A]*[B] [B]*[A]
Matrix multiplication can be performed only if the inner dimensions are equal Matrix Multiplication
zInterior dimensions have to be equal zFor a vector zWe will be using square matrices Matrix Multiplication
MATLAB zIn Fortran, the matrix multiplication have to be done by Do Loops zIn MATLAB, it is automatic A*B = C zNote no period ‘.’ (not element-by-element operation) zFor vectors A*x = b
Matrix Multiplication zAssociative ( [A] [B] ) [C] = [A] ( [B] [C] ) zDistributive [A] ( [B] + [C] ) = [A] [B] + [A] [C] ([A] + [B] ) [C] = [A] [C] + [B] [C] zNot generally commutative [A] [B] [B] [A]
Matrix Inverse zMatrix division is undefined zHowever, there is a matrix inverse for non-singular square matrices [A] 1 [A] = [A] [A] 1 = [I] zMultiplication of a matrix by the inverse is analogous to division
Augmentation Whatever you do to left-hand-side, do to the right- hand side (useful when solving system of equations)
Augmented Matrix
MATLAB Matrix Manipulations >> A = [ ; ; ; ] A = >> A' ans = Create a matrix Matrix transpose
MATLAB Matrix Manipulations >> x = [ ]; >> y = [ ]; >> z = [ ]; >> B = [x; y; x; z] B = >> C = A + B C = >> C = C – B ( = A) C = Matrix Concatenation Addition and Subtraction
MATLAB Matrix Manipulations A = B = >> A*B ans = >> A.*B ans = Matrix multiplication and element-by-element operation A*B A.*B
MATLAB Matrix Manipulations >> D = [ ; ; ] D = >> A*D ??? Error using ==> * Inner matrix dimensions must agree. >> D*A ans = A = Inner dimension must agree A*D D*A
MATLAB Matrix Manipulations >> A = [ ; ; ; ] >> format short; AI = inv(A) AI = >> A*AI ans = Matrix Inverse
MATLAB Matrix Manipulations >> A = [ ; ; ; ] >> I = eye(4) I = >> Aug = [A I] Aug = >> [n, m] = size(Aug) n = 4 m = 8 Matrix Augmentation
Bungee Jumpers [K] {x} = {b} JumperMass (kg)Spring constant (N/m)Unstretched cord length (m) Top (1) Middle (2) Bottom (3)805020
>> k1 = 50; k2 = 100; k3 = 50; >> K=[k1+k2 -k2 0;-k2 k2+k3 -k3;0 -k3 k3] K = >> format short >> g = 9.81; mg = [60; 70; 80]*g mg = >> x=K\mg x = >> xi = [20; 40; 60]; >> xf = xi + x xf = >> x = inv(K)*mg x = k 1 = 50 k 2 = 100 stiffer cord k 3 = 50 Final positions of bungee jumpers
F 14 F 23 F 12 F 24 F 45 H1H1 F 35 F 25 V3V3 V1V1 TRUSS W = 100 kg
Statics: Force Balance Node 1 Node 2 Node 3 Node 4 Node 5
Exampe: Forces in a Simple Truss
function [A, b]=Truss(alpha, beta, gamma, delta) A = zeros(10,10); A(1,1) = 1; A(1,5) = sin(alpha); A(2,2) = 1; A(2,4) = 1; A(2,5) = cos(alpha); A(3,7) = sin(beta); A(3,8) = sin(gamma); A(4,4) = -1; A(4,6) = 1; A(4,7) = -cos(beta); A(4,8) = cos(gamma); A(5,3)= 1; A(5,9) = sin(gamma); A(6,6) = -1; A(6,9) = -cos(delta); A(7,5) = -sin(alpha); A(7,7)=-sin(beta); A(8,5) = -cos(alpha); A(8,7) = cos(beta); A(8,10)=1; A(9,8) = -sin(gamma); A(9,9) = -sin(delta); A(10,8) = -cos(gamma); A(10,9) = cos(delta); A(10,10) = -1; b = zeros(10,1); b(3,1)=100; f = A\b Define Matrices A and b in script file [A]{ f } = {b} { f } = [A] 1 {b}