Matrix Computations ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.

Slides:



Advertisements
Similar presentations
Slide deck by Dr. Greg Reese Miami University MATLAB An Introduction With Applications, 5 th Edition Dr. Amos Gilat The Ohio State University Chapter 3.
Advertisements

Lecture 9: Introduction to Matrix Inversion Gaussian Elimination Sections 2.4, 2.5, 2.6 Sections 2.2.3, 2.3.
Lecture 6 Matrix Operations and Gaussian Elimination for Solving Linear Systems Shang-Hua Teng.
Maths for Computer Graphics
Lecture 6 Intersection of Hyperplanes and Matrix Inverse Shang-Hua Teng.
Solution of Simultaneous Linear Algebraic Equations: Lecture (I)
Ch 7.2: Review of Matrices For theoretical and computation reasons, we review results of matrix theory in this section and the next. A matrix A is an m.
EGR 106 – Week 4 – Math on Arrays
Part 3 Chapter 8 Linear Algebraic Equations and Matrices PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The.
Matrix Mathematics in MATLAB and Excel
Matrix Approach to Simple Linear Regression KNNL – Chapter 5.
Lecture 7: Matrix-Vector Product; Matrix of a Linear Transformation; Matrix-Matrix Product Sections 2.1, 2.2.1,
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
CE 311 K - Introduction to Computer Methods Daene C. McKinney
Modified Gary Larson Far Side cartoon
1 Chapter 3 Matrix Algebra with MATLAB Basic matrix definitions and operations were covered in Chapter 2. We will now consider how these operations are.
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 10 Review: Matrix Algebra
ECON 1150 Matrix Operations Special Matrices
MATLAB Basics With a brief review of linear algebra by Lanyi Xu modified by D.G.E. Robertson.
Matrix Algebra. Quick Review Quick Review Solutions.
Predefined MATLAB Functions ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Review of Matrices Or A Fast Introduction.
1 Math Review Coordinate systems 2-D, 3-D Vectors Matrices Matrix operations.
CSE123 Lecture 5 Arrays and Array Operations. Definitions Scalars: Variables that represent single numbers. Note that complex numbers are also scalars,
Array Addition  Two arrays can be added if and only if both arrays have exactly the same dimensions.  Assuming the dimension requirement is satisfied,
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Introduction to MATLAB CBE 502 Mathematical Methods of Engineering Analysis.
Learner’s Guide to MATLAB® Chapter 2 : Working with Arrays.
CMPS 1371 Introduction to Computing for Engineers MATRICES.
8.1 Matrices & Systems of Equations
Copyright © 2011 Pearson, Inc. 7.2 Matrix Algebra.
Lecture 28: Mathematical Insight and Engineering.
Matrix Multiplication The inner dimensions must be the same (or the number of columns in the first matrix is equal to the number of rows in the second.
Algebra 3: Section 5.5 Objectives of this Section Find the Sum and Difference of Two Matrices Find Scalar Multiples of a Matrix Find the Product of Two.
Linear algebra: matrix Eigen-value Problems Eng. Hassan S. Migdadi Part 1.
2009/9 1 Matrices(§3.8)  A matrix is a rectangular array of objects (usually numbers).  An m  n (“m by n”) matrix has exactly m horizontal rows, and.
A string is an array of characters Strings have many uses in MATLAB Display text output Specify formatting for plots Input arguments for some functions.
Chapter 6 Systems of Linear Equations and Matrices Sections 6.3 – 6.5.
ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University.
Matrix Computations ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
1 ECE 1304 Introduction to Electrical and Computer Engineering Section 1.7 Linear Algebra with MATLAB.
September 15, 2005 Lecture 5 - By Paul Lin 1 CPET 190 Lecture 5 Problem Solving with MATLAB
MT411 Robotic Engineering Asian Institution of Technology (AIT) Chapter 1 Introduction to Matrix Narong Aphiratsakun, D.Eng.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
2.5 – Determinants and Multiplicative Inverses of Matrices.
Finishing up Chapter 5. Will this code enter the if statement? G=[30,55,10] if G
Linear Algebra Review Tuesday, September 7, 2010.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 3 - Chapter 8 Linear Algebraic Equations and Matrices.
Matrices. Variety of engineering problems lead to the need to solve systems of linear equations matrixcolumn vectors.
Numerical Computation Lecture 6: Linear Systems – part II United International College.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
MTH108 Business Math I Lecture 20.
EEE 244-3: MATRICES AND EQUATION SOLVING
Solving Linear Systems Syed Nasrullah
Linear Algebraic Equations and Matrices
응용 전산 및 실습 MATLAB – Chapter 3 행렬연산
Chapter 7 Matrix Mathematics
The Inverse of a Square Matrix
Linear Algebraic Equations and Matrices
Linear independence and matrix rank
Matrix Operations SpringSemester 2017.
EGR 106 – Week 4 – Math on Arrays
MATRICES MATRIX OPERATIONS.
Unit 3: Matrices
ARRAY DIVISION Identity matrix Islamic University of Gaza
Multiplication of Matrices
EEE 244-3: MATRICES AND EQUATION SOLVING
Math review - scalars, vectors, and matrices
Matrix Operations SpringSemester 2017.
Presentation transcript:

Matrix Computations ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne

206_M62 Dot Product  Scalar formed by sum of products of vector elements dot_product = sum(A.*B); dot(A,B);

206_M63 Example  Find Total Mass num_items = [ ] mass_items = [ ] item_totals = num_items.* mass_items total_mass = sum(item_totals) total_mass = dot(num_items,mass_items)

206_M64 Matrix Multiplication  Value in position (i,j) is dot product of row i of the first matrix with column j of the second matrix Inner dimensions must be the same (conformable) A = [2 5 1;0 3 -1] (2 x 3) B = [1 0; -1 4; 5 2] (3 x 2) C = A * B (2 x 2) C11 = sum(A(1,:).*B(:,1)')

206_M65 Matrix Powers  Square of each element of a matrix A.^2  Square of a matrix A^2 A*A  Other powers A^3 A*A*A...

206_M66 Other Matrix Functions  Matrix Inverse Product of matrix and it's inverse yields identity matrix AA -1 = I and A -1 A = I B = inv(A) I = A*B  Determinant Scalar computed from entries of a square matrix e.g. (2 x 2): |A| = a 1,1 a 2,2 - a 2,1 a 1,2 det(A)

206_M67 Special Matrices  Matrix of Zeros zeros(3) zeros(3,2)  Matrix of Ones ones(3) ones(3,2)  Identity Matrix eye(3)

206_M68 Systems of Linear Equations  System of 3 equations with 3 unknowns 3x 1 + 2x 2 - x 3 = 10 -x 1 + 3x 2 + 2x 3 = 5 x 1 - x 2 - x 3 = -1  Matrix representation AX = B

206_M69 Solving Simultaneous Equations  Solution Using the Matrix Inverse AX = B A -1 AX = A -1 B IX = A -1 B X = A -1 B  MATLAB Solution X = inv(A)*B  Better MATLAB Solution using Left Division X = A\B Uses Gaussian elimination (without forming the inverse)

206_M610 Example  Mesh Analysis Problem Statement Find mesh currents for a given circuit Input/Output Description Four resistance values Three mesh current values Three voltage values

206_M611 Example Hand Example Zero voltage results in zero current See example in circuits text Algorithm Development Input resistance values Input voltage source values Form resistance matrix Form voltage matrix Compute current matrix

206_M612 MATLAB Solution R1 = input('Input the value of R1: '); R2 = input('Input the value of R2: '); R3 = input('Input the value of R3: '); R4 = input('Input the value of R4: '); V1 = input('Input the value of V1: '); V2 = input('Input the value of V2: '); V3 = input('Input the value of V3: '); resistance = [R1+R2, -R2, -R1 ; -R2, R2+R3, -R3 ; -R1, -R3, R1+R3+R4] voltage = [V1; -(V2+V3); V3] I = inv(resistance)*voltage Ialt = resistance\voltage

206_M613 Testing  R1 = 1;  R2 = 2;  R3 = 3;  R4 = 4;  V1 = 7;  V2 = 3;  V3 = 9;  I1 = 2;  I2 = -1;  I3 = 1;

206_M614 Signal-to-Noise Ratio  Signal Power (Amplitude) power = sum(x.^2)/length(x)  Signal Power (Variance and Mean) power = std(x)^2 + mean(x)^2  Signal Power (Sinusoid) x = A*sin(2*pi*t) power = A^2/2  Signal-to-Noise Ratio SNR = (signal power)/(noise power)

206_M615 Random Numbers  Uniform Random Numbers rand('seed',n), rand(n), rand(m,n) Interval 0 to 1 Interval a to b x = (b - a)*r + a;  Gaussian Random numbers randn('seed',n), randn(n), randn(m,n) Normal Distribution Mean = 0, Standard Deviation = 1.0 Modified Distribution Mean = b, Standard Deviation = a x = a*r + b;

206_M616 Random Noise  Uniform Noise rand(1,n) Interval -a to +a mean = 0 variance = a 2 /3 x = 2*a*r - a  Gaussian Noise randn(1,n) Standard Deviation = a mean = 0 variance = a 2 x = a*r

206_M617 Sinusoid plus Uniform Noise % Sine plus Uniform Noise t=0:0.01:2; noise_u=2*rand(1,201)-1; sine=4*sin(2*pi*t); s_u=sine+noise_u; power_sine=sum(sine.^2)/length(sine) power_noise_u=sum(noise_u.^2)/length(noise_u) SNR_u=power_sine/power_noise_u figure(1) plot(t,s_u) figure(2) hist(noise_u)

206_M618 Sinusoid plus Gaussian Noise % Sine plus Gaussian Noise t=0:0.01:2; sine=4*sin(2*pi*t); noise_g=1/sqrt(3)*randn(1,201); s_g=sine+noise_g; power_sine=sum(sine.^2)/length(sine) power_noise_g=sum(noise_g.^2)/length(noise_g) SNR_g=power_sine/power_noise_g figure(3) plot(t,s_g) figure(4) hist(noise_g)

206_M619 Problem Solving Applied  Signal Generation with Noise Problem Statement Generate a sinusoidal signal with a given amplitude and addition of uniform noise with a specified signal- to-noise ratio Input/Output Description Signal Plot Signal and Noise Power SNR Sine Wave Amplitude Desired SNR

206_M620 Problem Solving Applied Hand Example SNR = (signal power)/(noise power) signal power = A 2 /2 noise power = a 2 /3 Algorithm Development Prompt for A and SNR Compute a Generate sine and noise Compute powers and SNR Plot sine plus noise

206_M621 MATLAB Solution % Sine plus Uniform Noise at SNR A = input('Enter amplitude of sinusoid: '); SNR = input('Enter desired signal-to-noise ratio: '); a=sqrt(1.5*A^2/SNR); t=0:0.01:2; sine=A*sin(2*pi*t); noise_u=2*a*rand(1,201)-a; power_sine=sum(sine.^2)/length(sine); power_noise_u=sum(noise_u.^2)/length(noise_u); SNR_u=power_sine/power_noise_u s_u=sine+noise_u; plot(t,s_u) title('Sinusoid with Uniform Noise')

206_M622 Summary  Matrix Computations  Systems of Simultaneous Equations  Signal-to-Noise Ratio

206_M623 Test #4 Review  Programming in MATLAB Problems with two variables Input / Output Functions Control Structures  Matrix Computations  Systems of Simultaneous Equations  Signal-to-Noise Ratio