Chapter 4 Review: Manipulating Matrices Introduction to MATLAB 7 Engineering 161.

Slides:



Advertisements
Similar presentations
4.1 Introduction to Matrices
Advertisements

Introduction to arrays
Lecture 4.
Linear Algebra Applications in Matlab ME 303. Special Characters and Matlab Functions.
Chapter 8 and 9 Review: Logical Functions and Control Structures Introduction to MATLAB 7 Engineering 161.
Determinants (10/18/04) We learned previously the determinant of the 2 by 2 matrix A = is the number a d – b c. We need now to learn how to compute the.
Maths for Computer Graphics
CIS 101: Computer Programming and Problem Solving Lecture 2 Usman Roshan Department of Computer Science NJIT.
Concatenation MATLAB lets you construct a new vector by concatenating other vectors: – A = [B C D... X Y Z] where the individual items in the brackets.
Lecture 2 MATLAB fundamentals Variables, Naming Rules, Arrays (numbers, scalars, vectors, matrices), Arithmetical Operations, Defining and manipulating.
Module 6 Matrices & Applications Chapter 26 Matrices and Applications I.
Matrix Definition A Matrix is an ordered set of numbers, variables or parameters. An example of a matrix can be represented by: The matrix is an ordered.
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 2 Systems of Linear Equations and Matrices Section 2.4 Multiplication of Matrices.
Chapter 10 Review: Matrix Algebra
Introduction to MATLAB Session 1 Prepared By: Dina El Kholy Ahmed Dalal Statistics Course – Biomedical Department -year 3.
Introduction to MATLAB January 18, 2008 Steve Gu Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,
CSE123 Lecture 5 Arrays and Array Operations. Definitions Scalars: Variables that represent single numbers. Note that complex numbers are also scalars,
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
Two dimensional arrays in Java Computer Science 3 Gerb Objective: Use matrices in Java.
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Matlab for Engineers Manipulating Matlab Matrices Chapter 4.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Advanced Topics- Functions Introduction to MATLAB 7 Engineering 161.
Class Opener:. Identifying Matrices Student Check:
4.4 Identify and Inverse Matrices Algebra 2. Learning Target I can find and use inverse matrix.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
Chapter 6 Review: User Defined Functions Introduction to MATLAB 7 Engineering 161.
Working with Arrays in MATLAB
Fundamentals of Engineering Analysis
Chapter 2 Creating Arrays Legend: MATLAB command or syntax : Blue MATLAB command OUTPUT : LIGHT BLUE.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 1: Variables & Arrays Wednesday 03 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Section 1.7 Linear Independence and Nonsingular Matrices
CMPS 1371 Introduction to Computing for Engineers VECTORS.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
Arrays.
Digital Image Processing. Converting between Data Classes The general syntax is B = data_class_name (A) Where data_class_name is one of the names defined.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
CS 450: COMPUTER GRAPHICS TRANSFORMATIONS SPRING 2015 DR. MICHAEL J. REALE.
Manipulating MATLAB Vector, Matrices 1. Variables and Arrays What are variables? You name the variables (as the programmer) and assign them numerical.
Matrices. Matrix - a rectangular array of variables or constants in horizontal rows and vertical columns enclosed in brackets. Element - each value in.
Introduction Types of Matrices Operations
MATRICES A rectangular arrangement of elements is called matrix. Types of matrices: Null matrix: A matrix whose all elements are zero is called a null.
ENG College of Engineering Engineering Education Innovation Center 1 Arrays in MATLAB Topics Covered: 1.Creating arrays of numbers vectors matrices.
LAB 2 Vectors and Matrices Dr.Abdel Fattah FARES.
ECE 1304 Introduction to Electrical and Computer Engineering
Manipulating MATLAB Matrices Chapter 4
EGR 115 Introduction to Computing for Engineers
Introduction to Matrices
2. Matrix Algebra 2.1 Matrix Operations.
Vectors and Matrices I.
Digital Image Processing
CSCI N207 Data Analysis Using Spreadsheet
Communication and Coding Theory Lab(CS491)
Array Creation ENGR 1181 MATLAB 02.
Presented By Farheen Sultana Ist Year I SEM
Matrices.
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Matlab Training Session 2: Matrix Operations and Relational Operators
Matlab Basics Tutorial
Matrices Introduction.
EECS Introduction to Computing for the Physical Sciences
Matrices.
Matrix Operations Ms. Olifer.
Working with Arrays in MATLAB
Presentation transcript:

Chapter 4 Review: Manipulating Matrices Introduction to MATLAB 7 Engineering 161

Defining Matrices I In MATLAB, a matrix can be defined by typing a list of numbers enclosed by square brackets. A matrix can also be defined by listing each row on a separate line. When you get more comfortable with MATLAB you find other short hand ways to enter matrices, row or column vectors. Use … to extend a line if needed to enter large matrices or long row vectors.

Defining Matrices II Suppose s = [1.5, 2.2, 1.7, -4.1], then s(3) = 1.7, and so on. You can use the word end to identify the final element in a row or column, so s(end) = -4.1 A = [ ] is the empty matrix with length equal to 0 For 2 dimensional matrices you can identify an element by either specifying both the row and column or using a single index number where the elements are listed by column.

Problems with Two Variables I So far we have only considered problems of the form y = f(x), that is, problems of a single variable. Often in engineering we have to deal with problems of two variables, where z = g(x,y). MATLAB has a built in function called meshgrid to help accomplish this. Consider the following example;

Problems with Two Variables II x = 0:5; y = 1:1:3; And we want to compute, for example, z = x 2 +xy + y 2 If we write the MATLAB statement z = x.^2 + x.*y + y.^2 We will get an error message. Why??

Problems with Two Variables III Now consider; x = 0:5; y = 1:1:3; [X,Y] = meshgrid(x,y); z = X.^2 + X.*Y + Y.^2 The new matrices X and Y created by the meshgrid function are now of the same size and the expression for z makes sense.

Problems with Two Variable IV The new matrices look like; X = z = X.^2 + X.*Y + Y.^2 Y =

When we perform the computation as given in the previous slides, all points will be calculated using one MATLAB statement. Let’s look at another example; Suppose we want to calculate d= 1/2gt 2 for both the moon and earth for 0< t < 10 seconds. Here g and t are vectors, g = [2.4, 9.8] and for t = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. Consider the following MATLAB statements; t = 0:10; g = [ 2.4, 9.8]; [T, G] = meshgrid(t,g); d = 0.5*G.*T.^2; results = [t’, d’] d would be an 2x11 matrix, results for both the earth and moon Problems with Two Variable V

MATLAB contains a number of built in functions that generate special matrices. You’ll find these matrices very useful as you advance with you MATLAB skills. Matrix of zeros: A = zeros(3) or B = zeros(2,4) Matrix of ones:A = ones(2) or B = ones(2,5) Magic matrices:C = magic(4) creates a matrix called a Magic Square that has special properties. Special Matrices I

Special Matrices II Diagonal matrices: Use the function diag(A) in one of two ways; If A is mxn matrix, B = diag(A) returns B as a column vector of the diagonal elements of A. B = diag(A, 1) would produce the elements of the diagonal above the main diagonal, diag(A, -1), below the main diagonal. If A is a row matrix, B = diag(A) produces a matrix with the elements of A form the diagonal of B, with zeros everywhere else.

Chapter 4 Assignments Chapter 4 assignments let you practice working with problems with two variables and matrices. They are, 4.1, 4.8, 4.12.