LAB 2 Vectors and Matrices Dr.Abdel Fattah FARES.

Slides:



Advertisements
Similar presentations
2.3 Modeling Real World Data with Matrices
Advertisements

Matrices A matrix is a rectangular array of quantities (numbers, expressions or function), arranged in m rows and n columns x 3y.
3_3 An Useful Overview of Matrix Algebra
Maths for Computer Graphics
CIS 101: Computer Programming and Problem Solving Lecture 2 Usman Roshan Department of Computer Science NJIT.
EGR 106 – Week 3 – More on Arrays Brief review of last week Additional ideas: – Special arrays – Changing an array – Some array operators – Character arrays.
Matrices The Basics Vocabulary and basic concepts.
Intro to Matrices Don’t be scared….
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
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
4.2 Operations with Matrices Scalar multiplication.
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.
Little Linear Algebra Contents: Linear vector spaces Matrices Special Matrices Matrix & vector Norms.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
Overview Definitions Basic matrix operations (+, -, x) Determinants and inverses.
Lecture 28: Mathematical Insight and Engineering.
Unit 3: Matrices.
Matrices. Definitions  A matrix is an m x n array of scalars, arranged conceptually as m rows and n columns.  m is referred to as the row dimension.
Arrays 1 Multiple values per variable. Why arrays? Can you collect one value from the user? How about two? Twenty? Two hundred? How about… I need to collect.
MAT 2401 Linear Algebra 2.1 Operations with Matrices
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.
Meeting 18 Matrix Operations. Matrix If A is an m x n matrix - that is, a matrix with m rows and n columns – then the scalar entry in the i th row and.
Slide Copyright © 2009 Pearson Education, Inc. 7.3 Matrices.
Matrices: Simplifying Algebraic Expressions Combining Like Terms & Distributive Property.
INTRODUCTION TO MATLAB DAVID COOPER SUMMER Course Layout SundayMondayTuesdayWednesdayThursdayFridaySaturday 67 Intro 89 Scripts 1011 Work
3.4 Solution by Matrices. What is a Matrix? matrix A matrix is a rectangular array of numbers.
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.
CMPS 1371 Introduction to Computing for Engineers VECTORS.
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.
Manipulating MATLAB Vector, Matrices 1. Variables and Arrays What are variables? You name the variables (as the programmer) and assign them numerical.
Linear System of Simultaneous Equations Warm UP First precinct: 6 arrests last week equally divided between felonies and misdemeanors. Second precinct:
3.5 Perform Basic Matrix Operations Add Matrices Subtract Matrices Solve Matric equations for x and y.
Unit 3: Matrices. Matrix: A rectangular arrangement of data into rows and columns, identified by capital letters. Matrix Dimensions: Number of rows, m,
Matrix Algebra Definitions Operations Matrix algebra is a means of making calculations upon arrays of numbers (or data). Most data sets are matrix-type.
Matrices. Variety of engineering problems lead to the need to solve systems of linear equations matrixcolumn vectors.
Ch. 12 Vocabulary 1.) matrix 2.) element 3.) scalar 4.) scalar multiplication.
Vectors, Matrices and their Products Hung-yi Lee.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
ENG College of Engineering Engineering Education Innovation Center 1 Arrays in MATLAB Topics Covered: 1.Creating arrays of numbers vectors matrices.
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices.
MTH108 Business Math I Lecture 20.
13.4 Product of Two Matrices
Matrices and Matrix Operations
12-1 Organizing Data Using Matrices
Matrix Operations Free powerpoints at
Linear Algebra review (optional)
Matrix Operations.
Matrix Operations.
Matrix Operations Free powerpoints at
Matrix Operations Monday, August 06, 2018.
Matrix Operations.
Matrix Operations Free powerpoints at
Multiplying Matrices.
WarmUp 2-3 on your calculator or on paper..
7.3 Matrices.
MATRICES MATRIX OPERATIONS.
Unit 3: Matrices
MATRICES MATRIX OPERATIONS.
Multiplying Matrices.
1.8 Matrices.
1.8 Matrices.
Multiplying Matrices.
Multiplying Matrices.
Multiplying Matrices.
Presentation transcript:

LAB 2 Vectors and Matrices Dr.Abdel Fattah FARES

Vectors : A vector is a one-dimensional array of numbers. MATLAB allows you to create column vectors or row vectors. Column vectors >> a = [2; 1; 4] a = row vectors >> v = [2 0 4] v = >> w = [1,1,9] w = 1 1 9

>> A = [1 2 3; ; ] A =

Transpose operation In MATLAB, we represent the transpose operation with a single quote or tick mark (‘). Taking the transpose of a column vector produces a row vector:

>> v = [ ] v = >> w = v’ w = Transpose Operator (1)

Transpose Operator (2)

Add or Subtract two vectors Vectors with Uniformly Spaced Elementsx = [xi : q : xe]

The length command returns the number of elements that a vector contains. For example: The length : MAX & MIN

>> x=[0:3:10] x =

array multiplication summation square root

Matrices :

Matrices scalar multiplication add and subtract

The transpose Array multiplication

Matrix Multiplication Consider two matrices A and B. If A is an m × p matrix and B is a p × n matrix, they can be multiplied together to produce an m × n matrix. To do this in MATLAB, we leave out the period (.) and simply write A*B. Keep in mind that if the dimensions of the two matrices are not correct, the operation will generate an error.

More Basic Operations

Creating vectors with linspace (1) The linspace function creates vectors with elements having uniform linear spacing. Syntax: x = linspace(startValue,endValue,nelements) Examples: >> u = linspace(0.0,0.25,5) u =

Creating vectors with linspace (2) Column vectors are created by appending the transpose operator to linspace >> v = linspace(0,9,4)’ v =

Special Matrix Types The identity matrix is a square matrix that has ones along the diagonal and zeros elsewhere. To create an n × n identity matrix, type the following MATLAB command: eye(n) Syntax: A = eye(n) A = eye(nrows,ncols) Let’s create a 4 × 4 identity matrix:

Use ones and zeros to set intial values of a matrix or vector. Syntax: A = ones(nrows,ncols) A = zeros(nrows,ncols)

The diag function can either create a matrix with specified diagonal elements, or extract the diagonal elements from a matrix

Referencing Matrix Elements

change the value of matrix elements delete a row or column in a matrix