{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Lecture31 - Lecture 31 Creating and Manipulating Matrices...

This preview shows pages 1–10. Sign up to view the full content.

Engineering 101 Engineering 101 Lecture 31 Lecture 31 Creating and Manipulating Matrices in Creating and Manipulating Matrices in MATLAB MATLAB Prof. Michael Falk University of Michigan, College of Engineering

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Announcements Announcements Project 7 – Due Weds Nov 22 at 5pm Turned in on paper in Pierpont B519 May be turned in early to your GSI or to their mailbox in Pierpont B519 (note that this room is not open all hours).
Announcements Announcements Exam 3 Tonight, 7-9pm Exam Rooms by Last Name: A-B Dow 1018 C-G Chrysler 133 H-K Dow 1017 L-O Dow 1014 P-Z Chrysler 220 (Cheseborough)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Announcements Announcements You may bring your book, notes, or any other materials you desire. You may bring a calculator. If you have questions about the exam ask the proctor (me or a GSI). You may not communicate with each other or anyone other than the proctor during the exam.
Creating Matrices Creating Matrices Matrices are automatically assumed to be in row order separated by commas or spaces. Rows can be separated by semicolons (;) or new lines. a = [1.0, 3.0, 5.0; 2.0, 4.0, 6.0] b = [1.0 3.0 5.0 2.0 4.0 6.0 ]

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Creating Matrices Creating Matrices The number of elements in every row must be the same and the number of elements in every column must be the same. b = [ 10 15 20; 6 9 ] error!
Creating Matrices Creating Matrices An element of a matrix may be referenced using parentheses. Note that, unlike C++, rows and columns in MATLAB are numbered starting at 1. If c has not been previously created c(2, 3) = 5; Is equivalent to the statement c = [ 0 0 0 0 0 5 ];

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Creating Matrices Creating Matrices You may also use algebraic operations or references to data in the definition of an array a = [ 0 1+1 1+3*4 ]; b = [ a(2) a(1) a ]; Is equivalent to a = [ 0 2 13 ]; b = [ 2 0 0 2 13 ];
Shortcut Expressions for Matrix Shortcut Expressions for Matrix Initialization Initialization If you want to create a vector in which the terms are regularly spaced you can use the colon operator.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}