EEE 244 3 MATRICES AND EQUATION SOLVING Application

  • Slides: 24
Download presentation
EEE 244 -3: MATRICES AND EQUATION SOLVING

EEE 244 -3: MATRICES AND EQUATION SOLVING

Application of Matrices • Matrices occur in solution of linear equations for Electrical Engineering

Application of Matrices • Matrices occur in solution of linear equations for Electrical Engineering problems • Example of linear equations: Voltage-current relation V 1 = Z 11 I 1 + Z 12 I 2 V 2 = Z 21 I 1 + Z 22 I 2

Matrix structure • A matrix consists of a rectangular array of elements represented by

Matrix structure • A matrix consists of a rectangular array of elements represented by a single symbol (example: A). • An individual entry of a matrix is an element (example: a 23) A=

Matrix elements • A horizontal set of elements is called a row and a

Matrix elements • A horizontal set of elements is called a row and a vertical set of elements is called a column • The first subscript of an element indicates the row while the second indicates the column • The size of a matrix is given as m rows by n columns, or simply m by n (or m x n)

Special Matrices • Matrices where m=n are called square matrices • There a number

Special Matrices • Matrices where m=n are called square matrices • There a number of special forms of square matrices:

Matrix Multiplication • The elements in the matrix C that results from multiplying matrices

Matrix Multiplication • The elements in the matrix C that results from multiplying matrices A and B are calculated using: • Matlab command: C = A*B

Matrix Inverse and Transpose • The inverse of a square, nonsingular matrix A is

Matrix Inverse and Transpose • The inverse of a square, nonsingular matrix A is that matrix which, when multiplied by A, yields the identity matrix. A A-1= A A-1 = I Matlab command: Ainv = inv(A) • The transpose of a matrix involves transforming its rows into columns and its columns into rows. (aij)T=aji Matlab command: A_transpose = A’

System of linear equations a 11 x 1 + a 12 x 2 +

System of linear equations a 11 x 1 + a 12 x 2 + a 13 x 3 ……… a 1 n xn = c 1 a 21 x 1 + a 22 x 2 + a 23 x 3 ……… a 2 n xn = c 2. . . an 1 x 1 + an 2 x 2 + an 3 x 3 ……… ann xn = cn

Matrix equation AX = C

Matrix equation AX = C

Solving With MATLAB • MATLAB provides two direct ways to solve systems of linear

Solving With MATLAB • MATLAB provides two direct ways to solve systems of linear algebraic equations AX = C – Matrix inversion X = inv(A)*C – Gaussian elimination (Left division) X = AC • Matrix inverse is less efficient than left-division and also only works for square, non-singular systems

Example electric circuit problem Find the resistor currents in the circuit below:

Example electric circuit problem Find the resistor currents in the circuit below:

KVL equations I 1 I 2 -10 + (I 1 -I 2) x 100

KVL equations I 1 I 2 -10 + (I 1 -I 2) x 100 = 0 => 100 I 1 -100 I 2 = 10 (I 2 -I 1) x 100 + I 2 x 100 -10 = 0 => -100 I 1 +200 I 2 = 10

Matrix equation

Matrix equation

MATLAB solution clear A=[ 100 -100; -100 200]; C= [10; 10]; I=inv(A)*C;

MATLAB solution clear A=[ 100 -100; -100 200]; C= [10; 10]; I=inv(A)*C;

Roots of equations • Engineering problems involve finding roots of complex equations • Equations

Roots of equations • Engineering problems involve finding roots of complex equations • Equations can be of different types: – – • Polynomials with powers of x Example: x 3 + 2 x 2 – 4 x +1 = 0 Transcendental functions containing sin(x), ex, log(x) Example: sin(x) – 4 x +1 = 0 Solution of complex equations require numerical techniques

Graphical Methods • Zero crossing is a simple method for obtaining the estimate of

Graphical Methods • Zero crossing is a simple method for obtaining the estimate of the root of the equation f(x)=0 • Graphing the function can also indicate types of roots: a) b) c) d) Same sign, no roots Different sign, one root Same sign, two roots Different sign, three roots

Search Method • Make two initial guesses that bracket the root: f(x)=0 • Find

Search Method • Make two initial guesses that bracket the root: f(x)=0 • Find two guesses xi and xi+1 where the sign of the function changes; that is, where f(xi ) f(x. I+1 ) < 0.

Incremental Search Method • Tests the value of the function at evenly spaced intervals

Incremental Search Method • Tests the value of the function at evenly spaced intervals • Finds brackets by identifying function sign changes between neighboring points

Incremental Search Hazards • If the spacing between the points of an incremental search

Incremental Search Hazards • If the spacing between the points of an incremental search are too far apart, brackets may be missed • Incremental searches cannot find brackets containing even-multiplicity roots regardless of spacing.

Bisection • The bisection method is the incremental search method in which the interval

Bisection • The bisection method is the incremental search method in which the interval is always divided in half • If a function changes sign over an interval, the function value at the midpoint is evaluated

Newton-Raphson Method • Form the tangent line to the f(x) curve at some guess

Newton-Raphson Method • Form the tangent line to the f(x) curve at some guess x, • then follow the tangent line to where it crosses the x-axis.

MATLAB’s fzero Function • MATLAB’s fzero command provides the best qualities of both bracketing

MATLAB’s fzero Function • MATLAB’s fzero command provides the best qualities of both bracketing and Newton Raphson methods • Step 1: Define the function fname = @(x) f(x) • Step 2: Use the fzero command [x, fx] = fzero(fname, x 0) ⁻ x 0 is the initial guess ⁻ x is the location of the root ⁻ fx is the function evaluated at that root

Polynomials • MATLAB has a built in program called roots to determine all the

Polynomials • MATLAB has a built in program called roots to determine all the roots of a polynomial - including imaginary and complex roots • Step 1: Define the vector with polynomial coefficients • Step 2: Use the roots command x = roots(c) – x is a column vector containing the roots – c is a row vector containing the polynomial coefficients

Polynomial commands • MATLAB’s poly function can be used to determine polynomial coefficients if

Polynomial commands • MATLAB’s poly function can be used to determine polynomial coefficients if roots are given: b = poly([v]) ₋ v is the vector containing roots of the polynomial ₋ b is the vector with polynomial coefficients • MATLAB’s polyval function can evaluate a polynomial at one or more points: polyval(a, 1) ₋ This calculates the value of the polynomial at x=1