Introduction to MATLAB Lecture 02

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

Economics 2301 Matrices Lecture 13.
Pam Perlich Urban Planning 5/6020
Matrix Mathematics in MATLAB and Excel
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
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
Compiled By Raj G. Tiwari
MATLAB Basics With a brief review of linear algebra by Lanyi Xu modified by D.G.E. Robertson.
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,
Introduction to MATLAB CBE 502 Mathematical Methods of Engineering Analysis.
Matrices Addition & Subtraction Scalar Multiplication & Multiplication Determinants Inverses Solving Systems – 2x2 & 3x3 Cramer’s Rule.
Ch X 2 Matrices, Determinants, and Inverses.
Lecture 28: Mathematical Insight and Engineering.
Unit 6 : Matrices.
13.1 Matrices and Their Sums
P1 RJM 06/08/02EG1C2 Engineering Maths: Matrix Algebra 1 EG1C2 Engineering Maths : Matrix Algebra Dr Richard Mitchell, Department of Cybernetics AimDescribe.
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 2 Creating Arrays Legend: MATLAB command or syntax : Blue MATLAB command OUTPUT : LIGHT BLUE.
ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University.
Matrix Algebra Section 7.2. Review of order of matrices 2 rows, 3 columns Order is determined by: (# of rows) x (# of columns)
MT411 Robotic Engineering Asian Institution of Technology (AIT) Chapter 1 Introduction to Matrix Narong Aphiratsakun, D.Eng.
MATRIX A set of numbers arranged in rows and columns enclosed in round or square brackets is called a matrix. The order of a matrix gives the number of.
Finishing up Chapter 5. Will this code enter the if statement? G=[30,55,10] if G
Do Now: Perform the indicated operation. 1.). Algebra II Elements 11.1: Matrix Operations HW: HW: p.590 (16-36 even, 37, 44, 46)
Matrices. Matrix - a rectangular array of variables or constants in horizontal rows and vertical columns enclosed in brackets. Element - each value in.
Matrix Algebra Basics Chapter 3 Section 5. Algebra.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
College Algebra Chapter 6 Matrices and Determinants and Applications
MTH108 Business Math I Lecture 20.
12-4: Matrix Methods for Square Systems
EEE 244-3: MATRICES AND EQUATION SOLVING
Linear Algebraic Equations and Matrices
12-1 Organizing Data Using Matrices
ECE 1304 Introduction to Electrical and Computer Engineering
Matrix Operations Free powerpoints at
Matrix Operations.
Chapter 7 Matrix Mathematics
10.5 Inverses of Matrices and Matrix Equations
Matrix Operations.
Matrix Operations Free powerpoints at
Linear Algebraic Equations and Matrices
Matrix Operations.
Matrix Operations SpringSemester 2017.
EGR 106 – Week 4 – Math on Arrays
Matrix Operations Free powerpoints at
Warm-up a. Solve for k: 13 −5
MATRICES MATRIX OPERATIONS.
27. Determinants and Inverses
MATRICES MATRIX OPERATIONS.
Lecture 11 Matrices and Linear Algebra with MATLAB
Unit 3: Matrices
( ) ( ) ( ) ( ) Matrices Order of matrices
2.2 Introduction to Matrices
Fundamentals of Engineering Analysis
Matrices.
ARRAY DIVISION Identity matrix Islamic University of Gaza
Matrix Algebra.
EEE 244-3: MATRICES AND EQUATION SOLVING
Solving simultaneous equations
Matrices in MATLAB Dr. Risanuri Hidayat.
MATRICES MATRIX OPERATIONS.
MATRICES MATRIX OPERATIONS.
Matrix Operations SpringSemester 2017.
Matrices are identified by their size.
Presentation transcript:

Introduction to MATLAB Lecture 02 Olawale B. Akinwale Department of Electronic and electrical Engineering Obafemi Awolowo university, Ile-Ife

MATRIX ALGEBRA 11/26/2018

Elementary Matrix Operations Defining matrices and vectors (arrays) >> A = [ 3 5 2; 3,-2,1] % a comma or space can be used >> A = [ 3 5 2; 3 -2 1] >> b = [ 0 1 2 3] >> b = 0:1:3 >> b = 0:3 >> B = [-2:1 ; 3 2i -29 sqrt(15)] The number of spaces between -2 and 1 here is irrelevant Note that the spacing here matters. There must be no space between the minus sign and the number 29 11/26/2018

Elementary Matrix Operations Adding, subtracting, multiplying, dividing and exponentiation are just like are done with variables ( A + B, C – B, B * A, A / B and A^3). You just need to take not of the order of the matrices. If instead of doing a matrix operation, you want to do element-wise operations e.g. squaring each element of a matrix instead of multiplying the whole matrix by itself, you simply put a dot in front of the operator in question. 11/26/2018

Examples 11/26/2018

Elementary Matrix Operations You can access the individual elements of a matrix or vector by using the appropriate subscripts in parenthesis separated by a comma. If A = [3 2; 1 20] then A(2,1) = the element on the second row and first column which is 1. A(1,2) is 2 and A(2,2) is 20 You can select a range of elements of a matrix by using the colon operator e.g. D(1:3, 2:4) will select the elements in the first three rows and the second to fourth column of the matrix D. We could also use E(:, 5:end) to select the elements in all the rows and the fifth to the last column of E. 11/26/2018

Elementary Matrix Operations (cont’d) >> sum(A) % sums up all elements of each column of A. If A is a vector, it sums up all its elements. >> prod(A) % multiplies up all elements of each column of A. If A is a vector, it multiplies all its elements >> inv(A) % finds the inverse of A >> det(A) % finds the determinant of A >> diag(A) % selects the diagonal elements of A >> diag([1 3 -2]) % creates a diagonal matrix with elements 1, 3 and -2 11/26/2018

Elementary Matrix Operations (cont’d) Matrices can be used to solve equations of the form Ax = b simply by finding the inverse of A and pre- multiplying b with it i.e. x = inv(A) * b. Optionally, in MATLAB, we can issue the command x = A\b and it does the same job. For example, given 11/26/2018

See you in the next class 11/26/2018