Download presentation
Presentation is loading. Please wait.
Published byAndrea Mortensen Modified over 5 years ago
1
Announcements Exam 2 Next Week!! Final Exam :
Monday May 6th, 2:00 – 4:00 p.m. HH 002 Wednesday : Exam 2 Study Day HH 002 for Questions
2
Arrays Array – Set of Values with One Name MatLab Creation :
arrayName = [ 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 MatLab, starting with 1) Row Vector - “Row” of Values Column Vector - “Column” of Values
3
Array Element Addition/Subtraction
>> rowV = [ 1, 3, 5 ] rowV = >> rowV + 2 ans = >> rowV - 5
4
Array Element Multiplication/Division
>> rowV * 2 ans = >> rowV / 2
5
Array Element Exponentiation
>> rowV^2 Error using ^ One argument must be a square matrix and the other must be a scalar. Use POWER (.^) for elementwise power. >> rowV.^2 ans =
6
Array to Array Operations
>> rowV2 = [ 2, 4, 6] rowV2 = >> rowV + rowV2 ans = >> rowV - rowV2
7
Array to Array Operations
>> rowV * rowV2 Error using * Inner matrix dimensions must agree. >> rowV .* rowV2 ans =
8
Array Functions – max(), min()
>> max(rowV) ans = 5 >> min(rowV) 1
9
Array Functions – length(), size()
length() - Number of Elements in Vector size() - Returns a vector [NumRows, NumCols] >> length(rowV) ans = 3 >> size(rowV)
10
Array Functions – sum()
>> sum(rowV) ans = 9 >> sum(rowV2) 12
11
Exam 2 Everything Through Quiz 2 if/then switch/case while loops
for loops Functions function result = doThis(parameter1, parameter2) Arrays Creation Access Scalar Element to Element Operations Array to Array Operations max(), min(), length(), size(), sum()
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.