Announcements.

Slides:



Advertisements
Similar presentations
Introduction to arrays
Advertisements

Introduction to Matlab
Maths for Computer Graphics
Lecture 4 Sept 8 Complete Chapter 3 exercises Chapter 4.
Concatenation MATLAB lets you construct a new vector by concatenating other vectors: – A = [B C D... X Y Z] where the individual items in the brackets.
Lecture 4 Sept 7 Chapter 4. Chapter 4 – arrays, collections and indexing This chapter discusses the basic calculations involving rectangular collections.
1 Introduction to MATLAB MATLAB is all of the following: 1.Computational environment 2.Plotting software 3.Programming language Typical applications: 1.Calculations.
Matlab tutorial course Lesson 2: Arrays and data types
A First Book of ANSI C Fourth Edition
SAS Interactive Matrix Language Computing for Research I Spring 2012 Ramesh.
Working with Arrays in MATLAB
ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University.
Matrices: Simplifying Algebraic Expressions Combining Like Terms & Distributive Property.
INTRODUCTION TO MATLAB DAVID COOPER SUMMER Course Layout SundayMondayTuesdayWednesdayThursdayFridaySaturday 67 Intro 89 Scripts 1011 Work
Array Accessing and Strings ENGR 1187 MATLAB 3. Today's Topics  Array Addressing (indexing)  Vector Addressing (indexing)  Matrix Addressing (indexing)
Manipulating MATLAB Vector, Matrices 1. Variables and Arrays What are variables? You name the variables (as the programmer) and assign them numerical.
Multidimensional Arrays Vectors of Vectors When One Is Not Enough.
Project Teams Project on Diffusion will be a TEAM project. 34 Students in class so 6 teams of 5 and one Team of 4. Determine members of team and a team.
Chapter 5: Matrices and Determinants Section 5.1: Matrix Addition.
Relational and Logical Operators EE 201 1C7-2 Spring 2012.
LAB 2 Vectors and Matrices Dr.Abdel Fattah FARES.
Introduction to Matlab. Outline:  What is Matlab? Matlab Screen Variables, array, matrix, indexing Operators.
Goals for today Learn to create, combine, and index arrays Learn to multiply arrays in MATLAB Use matrix multiplication to simulate a real-world problem.
Introduction To MATLAB
13.4 Product of Two Matrices
12-1 Organizing Data Using Matrices
Linear Algebra review (optional)
Matrix Operations.
Arrays An array is a grouping of elements of the same type that share a common base name Can have any number of elements in the array Individual elements.
Chapter 2 Creating Arrays.
Introduction to Matrices
Today’s Material Arrays Definition Declaration Initialization
Matrix Operations.
Linear Algebraic Equations and Matrices
Introduction To Matrices
Matrix Operations.
Matrix Operations SpringSemester 2017.
WarmUp 2-3 on your calculator or on paper..
Vectors and Matrices Chapter 2 Attaway MATLAB 4E.
7.3 Matrices.
Multidimensional Arrays Vectors of Vectors
Introduction to Matrices
Vectorized Code, Logical Indexing
Matrices Elements, Adding and Subtracting
Vectors and Matrices I.
Introduction to MATLAB [Vectors and Matrices] Lab 2
Digital Image Processing
CSCI N207 Data Analysis Using Spreadsheet
MATRICES MATRIX OPERATIONS.
2.2 Introduction to Matrices
MSIS 655 Advanced Business Applications Programming
Array Creation ENGR 1181 MATLAB 02.
Vectors and Matrices Chapter 2 Attaway MATLAB 4E.
Matrices.
Dr Tripty Singh Arrays.
5 minutes Warm-Up Evaluate each expression for a = -5, b = 1.3, and c = -7. 1) a + b 2) b - c 3) a – b + c 4) -4b Solve each equation. 5) 16 = 2x.
Multi-Dimensional Arrays
Arrays An array is a grouping of elements of the same type that share a common base name Can have any number of elements in the array Individual elements.
Introduction to Matlab
Matlab Training Session 2: Matrix Operations and Relational Operators
2-Dimensional Lists (Matrices) in Python
Linear Algebra review (optional)
EECS Introduction to Computing for the Physical Sciences
Matrices.
Matrix Operations SpringSemester 2017.
Arrays in MatLab Arrays can have any number dimensions
Working with Arrays in MATLAB
Announcements.
Announcements.
Announcements Exam 2 Next Week!! Final Exam :
Presentation transcript:

Announcements

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

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

Array Element Multiplication/Division >> rowV * 2 ans = 2 6 10 >> rowV / 2 0.5000 1.5000 2.5000

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 = 1 9 25

Array to Array Operations >> rowV2 = [ 2, 4, 6] rowV2 = 2 4 6 >> rowV + rowV2 ans = 3 7 11 >> rowV - rowV2 -1 -1 -1

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

Array Functions – max(), min() >> max(rowV) ans = 5 >> min(rowV) 1

Array Functions – length(), size() length() - Number of Elements in Vector size() - Returns a vector [NumRows, NumCols] >> length(rowV) ans = 3 >> size(rowV) 1 3

Array Functions – sum() >> sum(rowV) ans = 9 >> sum(rowV2) 12

Matrices Matrix – Two Dimensional Array MatLab Creation : matrixName = [ 1,3,5;2,4,6 ]; Row – Horizontal Values Column – Vertical Values Element – One Member (Value) in an Array Offset or Subscript – For Matrix, given as Row, Column Pair (e.g., matrixName(1,2) )

Matrix Creation >> matrixOne = [1,2,3;3,4,5]; >> disp(matrixOne) 1 2 3 3 4 5 >> rowV = [9, 10]; >> rowV2 = [11,12]; >> matrixTwo = [rowV;rowV2]; >> disp(matrixTwo) 9 10 11 12

Matrix Creatix (Cont) >> matrixThree = [matrixTwo; matrixTwo]; >> disp(matrixThree) 9 10 11 12 >> matrixThree = [matrixTwo, matrixTwo]; 9 10 9 10 11 12 11 12

Matrix Creation (Cont) >> disp(matrixOne) 1 2 3 3 4 5 >> disp(matrixTwo) 9 10 11 12 >> matrixFour = [matrixOne;matrixTwo]; Error using vertcat Dimensions of matrices being concatenated are not consistent. >> matrixFour = [matrixOne,matrixTwo]; >> disp(matrixFour) 1 2 3 9 10 3 4 5 11 12

Matrix Addressing >> disp(matrixFour) 1 2 3 9 10 3 4 5 11 12 1 2 3 9 10 3 4 5 11 12 >> disp(matrixFour(1,1)) 1 >> disp(matrixFour(2,5)) 12 >> disp(matrixFour(-3,1)) Subscript indices must either be real positive integers or logicals. >> disp(matrixFour(1,1000)) Index exceeds matrix dimensions. >> matrixFour(1,7) = 1000; 1 2 3 9 10 0 1000 3 4 5 11 12 0 0

Matrix Addressing (Cont) Colon (:) means “all” or range >> disp(matrixFour) 1 2 3 9 10 0 1000 3 4 5 11 12 0 0 >> disp(matrixFour(:,4)) 9 11 >> disp(matrixFour(2,:)) 3 4 5 11 12 0 0

Matrix Addressing (Cont) >> disp(matrixFour) 1 2 3 9 10 0 1000 3 4 5 11 12 0 0 >> disp(matrixFour(:,2:5)) 2 3 9 10 4 5 11 12

Matrix Scalar Operations >> disp(matrixFour) 1 2 3 9 10 0 1000 3 4 5 11 12 0 0 >> disp(matrixFour + 2) 3 4 5 11 12 2 1002 5 6 7 13 14 2 2 >> disp(matrixFour * 2) 2 4 6 18 20 0 2000 6 8 10 22 24 0 0

Matrix Transposition >> disp(matrixThree) 9 10 9 10 11 12 11 12 9 10 9 10 11 12 11 12 >> disp(matrixThree') 9 11 10 12

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()