{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture31 - Lecture 31 Creating and Manipulating Matrices...

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full Document Right Arrow Icon
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).
Background image of page 2
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)
Background image of page 3

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

View Full Document Right Arrow Icon
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.
Background image of page 4
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 ]
Background image of page 5

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

View Full Document Right Arrow Icon
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!
Background image of page 6
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 ];
Background image of page 7

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

View Full Document Right Arrow Icon
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 ];
Background image of page 8
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.
Background image of page 9

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

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}