Announcements Exam 2 Next Week Final Exam Monday

  • Slides: 11
Download presentation
Announcements • Exam 2 Next Week!! • Final Exam : • Monday May 6

Announcements • Exam 2 Next Week!! • Final Exam : • Monday May 6 th, 2: 00 – 4: 00 p. m. • HH 002 • Wednesday : Exam 2 Study Day • HH 002 for Questions

Arrays • Array – Set of Values with One Name • Mat. Lab Creation

Arrays • Array – Set of Values with One Name • Mat. Lab Creation : array. Name = [ 1, 3, 5 ]; • Vector – One Dimensional Array • Matrix – Two Dimensional Array • Element – One Member (Value) in an Array • Offset or Subscript – location of an Element in and Array (in Mat. Lab, starting with 1) • Row Vector - “Row” of Values • Column Vector - “Column” of Values

Array Element Addition/Subtraction >> row. V = [ 1, 3, 5 ] row. V

Array Element Addition/Subtraction >> row. V = [ 1, 3, 5 ] row. V = 1 3 5 >> row. V + 2 ans = 3 5 7 >> row. V - 5 ans = -4 -2 0

Array Element Multiplication/Division >> row. V * 2 ans = 2 6 10 >>

Array Element Multiplication/Division >> row. V * 2 ans = 2 6 10 >> row. V / 2 ans = 0. 5000 1. 5000 2. 5000

Array Element Exponentiation >> row. V^2 Error using ^ One argument must be a

Array Element Exponentiation >> row. V^2 Error using ^ One argument must be a square matrix and the other must be a scalar. Use POWER (. ^) for elementwise power. >> row. V. ^2 ans = 1 9 25

Array to Array Operations >> row. V 2 = [ 2, 4, 6] row.

Array to Array Operations >> row. V 2 = [ 2, 4, 6] row. V 2 = 2 4 6 >> row. V + row. V 2 ans = 3 7 11 >> row. V - row. V 2 ans = -1 -1 -1

Array to Array Operations >> row. V * row. V 2 Error using *

Array to Array Operations >> row. V * row. V 2 Error using * Inner matrix dimensions must agree. >> row. V. * row. V 2 ans = 2 12 30

Array Functions – max(), min() >> max(row. V) ans = 5 >> min(row. V)

Array Functions – max(), min() >> max(row. V) ans = 5 >> min(row. V) ans = 1

Array Functions – length(), size() length() - Number of Elements in Vector size() -

Array Functions – length(), size() length() - Number of Elements in Vector size() - Returns a vector [Num. Rows, Num. Cols] >> length(row. V) ans = 3 >> size(row. V) ans = 1 3

Array Functions – sum() >> sum(row. V) ans = 9 >> sum(row. V 2)

Array Functions – sum() >> sum(row. V) ans = 9 >> sum(row. V 2) ans = 12

Exam 2 • Everything Through Quiz 2 – if/then – switch/case – while loops

Exam 2 • Everything Through Quiz 2 – if/then – switch/case – while loops – for loops • Functions function result = do. This(parameter 1, parameter 2) • Arrays – Creation – Access – Scalar Element to Element Operations – Array to Array Operations – max(), min(), length(), size(), sum()