Chapter 2_Array.ppt - Arrays Arrays Arrays Two-dimensional...

Info icon This preview shows pages 1–23. Sign up to view the full content.

View Full Document Right Arrow Icon
Arrays
Image of page 1

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

View Full Document Right Arrow Icon
Arrays Arrays Two-dimensional Arrays Element-by-element Operations Matrix Operations Polynomial Operations Using Arrays
Image of page 2
The array is the fundamental form of Matlab, uses to store data. Scalars: one row and one column (special case) Vectors: Row : one row and multiple columns Column: multiple rows and one column Matrices: multiple rows and multiple columns
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
In Matlab, a vector, or any list of numbers, can be entered in a horizontal (row) or vertical (column) vectors. Ex: the data from the previous slide can be entered in rows:[1984 1986 1988 1990 1992 1994 1996] [127 130 136 145 158 178 211] or in column: 211 178 158 145 136 130 127 1996 1994 1992 1990 1988 1986 1984
Image of page 5

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

View Full Document Right Arrow Icon
A vector is created by typing the elements (numbers) Inside square brackets [ ]. To create a ROW VECTOR, type a space or a comma between the elements inside the square brackets.
Image of page 6
NOTE: Matlab is not “picky” about how the data is typed in. You can type spaces before and/or after the sign “=“. Between the elements you can have a space in addition to the comma, or you can type more than one space.
Image of page 7

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

View Full Document Right Arrow Icon
To create a COLUMN VECTOR, type a left bracket [, and Then enter the elements with a semicolon between them, or press <ENTER> after each element. Type a right bracket ] after the last element.
Image of page 8
CREATING VECTORS WITH CONSTANT SPACING Two common methods: - Specify first term : step size : last term - linspace (first term, last term, number of terms)
Image of page 9

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

View Full Document Right Arrow Icon
Image of page 10
Image of page 11

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

View Full Document Right Arrow Icon
Image of page 12
Image of page 13

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

View Full Document Right Arrow Icon
Image of page 14
Image of page 15

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

View Full Document Right Arrow Icon
Image of page 16
Image of page 17

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

View Full Document Right Arrow Icon
Image of page 18
Image of page 19

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern