Download presentation
Presentation is loading. Please wait.
1
Chapter 8 Linear Algebraic Equations and Matrices
2
Three individuals connected by bungee cords
3
Free-body diagrams Newton’s second law Rearrange the equations [K] {x} = {b}
4
Newton’s second law – equation of motion Kirchhoff’s current and voltage rules Mass-spring system (similar to bungee jumpers) Resistor circuits
5
zSolved single equations previously zNow consider more than one variable and more than one equation Linear Algebraic Equations
6
zLinear equations and constant coefficients za ij and b i are constants Linear Systems Linear Systems
7
Forces on a Truss zMost obvious example in Civil Engineering ztrusses: force balance at joints F1F1 F2F2 F3F3 R
8
Mathematical background zIt is convenient to write system of equations in matrix-vector form
9
Matrix Notations Column 4 Row 3 (second index) (first index)
10
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} )
11
z Square matrix, m = n zParticularly important when solving simultaneous equations in engineering applications za ii – principle or main diagonal Square Matrix
12
z Transpose zIn MATLAB, transpose is A zTrace is sum of diagonal elements zIn MATLAB, trace(A) Matrix Operations
13
Matrix Transpose
14
symmetric matrices Special Matrices a ij = a ji [A] T = [A]
15
Diagonal matrix Identity matrix Special Matrices [A][I] = [I][A] = [A]
16
Banded matrix – all elements are zero, with the exception of a band centered on the main diagonal Special Matrices Tridiagonal – three non-zero bands
17
lower triangular upper triangular Special Matrices
18
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
19
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] )
20
Multiplication of Matrix by a Scalar g = 5
21
Visual depiction of how the rows and columns line up in matrix multiplication Matrix Multiplication
22
Matrix Multiplications zRecall how matrix multiplication works [A]*[B] [B]*[A]
23
Matrix multiplication can be performed only if the inner dimensions are equal Matrix Multiplication
24
zInterior dimensions have to be equal zFor a vector zWe will be using square matrices Matrix Multiplication
25
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
26
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]
27
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
28
Augmentation Whatever you do to left-hand-side, do to the right- hand side (useful when solving system of equations)
29
Augmented Matrix
30
MATLAB Matrix Manipulations >> A = [1 5 3 -4; 2 5 6 -1; 3 4 -2 5; -1 3 2 6] A = 1 5 3 -4 2 5 6 -1 3 4 -2 5 -1 3 2 6 >> A' ans = 1 2 3 -1 5 5 4 3 3 6 -2 2 -4 -1 5 6 Create a matrix Matrix transpose
31
MATLAB Matrix Manipulations >> x = [5 1 -2 3]; >> y = [2 -1 4 2]; >> z = [3 -2 1 -5]; >> B = [x; y; x; z] B = 5 1 -2 3 2 -1 4 2 5 1 -2 3 3 -2 1 -5 >> C = A + B C = 6 6 1 -1 4 4 10 1 8 5 -4 8 2 1 3 1 >> C = C – B ( = A) C = 1 5 3 -4 2 5 6 -1 3 4 -2 5 -1 3 2 6 Matrix Concatenation Addition and Subtraction
32
MATLAB Matrix Manipulations A = 1 5 3 -4 2 5 6 -1 3 4 -2 5 -1 3 2 6 B = 5 1 -2 3 2 -1 4 2 5 1 -2 3 3 -2 1 -5 >> A*B ans = 18 7 8 42 47 5 3 39 28 -13 19 -14 29 -14 16 -21 >> A.*B ans = 5 5 -6 -12 4 -5 24 -2 15 4 4 15 -3 -6 2 -30 Matrix multiplication and element-by-element operation A*B A.*B
33
MATLAB Matrix Manipulations >> D = [2 4 3 1; 3 -5 1 2; 1 -1 3 2] D = 2 4 3 1 3 -5 1 2 1 -1 3 2 >> A*D ??? Error using ==> * Inner matrix dimensions must agree. >> D*A ans = 18 45 26 9 -6 0 -19 10 6 18 -5 24 A = 1 5 3 -4 2 5 6 -1 3 4 -2 5 -1 3 2 6 Inner dimension must agree A*D D*A
34
MATLAB Matrix Manipulations >> A = [1 5 3 -4; 2 5 6 -1; 3 4 -2 5; -1 3 2 6] >> format short; AI = inv(A) AI = -0.2324 0.2520 0.1606 -0.2467 0.2428 -0.1397 0.0457 0.1005 -0.1436 0.2063 -0.0862 0.0104 -0.1123 0.0431 0.0326 0.0718 >> A*AI ans = 1.0000 0 0 -0.0000 -0.0000 1.0000 0 0.0000 0.0000 0 1.0000 -0.0000 0.0000 0 0.0000 1.0000 Matrix Inverse
35
MATLAB Matrix Manipulations >> A = [1 5 3 -4; 2 5 6 -1; 3 4 -2 5; -1 3 2 6] >> I = eye(4) I = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 >> Aug = [A I] Aug = 1 5 3 -4 1 0 0 0 2 5 6 -1 0 1 0 0 3 4 -2 5 0 0 1 0 -1 3 2 6 0 0 0 1 >> [n, m] = size(Aug) n = 4 m = 8 Matrix Augmentation
36
Bungee Jumpers [K] {x} = {b} JumperMass (kg)Spring constant (N/m)Unstretched cord length (m) Top (1)605020 Middle (2)7010020 Bottom (3)805020
37
>> k1 = 50; k2 = 100; k3 = 50; >> K=[k1+k2 -k2 0;-k2 k2+k3 -k3;0 -k3 k3] K = 150 -100 0 -100 150 -50 0 -50 50 >> format short >> g = 9.81; mg = [60; 70; 80]*g mg = 588.6000 686.7000 784.8000 >> x=K\mg x = 41.2020 55.9170 71.6130 >> xi = [20; 40; 60]; >> xf = xi + x xf = 61.2020 95.9170 131.6130 >> x = inv(K)*mg x = 41.2020 55.9170 71.6130 k 1 = 50 k 2 = 100 stiffer cord k 3 = 50 Final positions of bungee jumpers
38
1 4 2 3 5 F 14 F 23 F 12 F 24 F 45 H1H1 F 35 F 25 V3V3 V1V1 TRUSS W = 100 kg
39
Statics: Force Balance Node 1 Node 2 Node 3 Node 4 Node 5
40
Exampe: Forces in a Simple Truss
41
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}
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.