# Deleting elements. Adding elements Some useful Array functions find(A)  Computes an array containing the indices of the nonzero elements of A.

Post on 20-Dec-2015

217 views

Category:

## Documents

Embed Size (px)

TRANSCRIPT

• Slide 1
• Deleting elements
• Slide 2
• Slide 3
• Slide 4
• Slide 5
• Some useful Array functions find(A) Computes an array containing the indices of the nonzero elements of A.
• Slide 6
• Some useful Array functions
• Slide 7
• max(x)/min(x): returns the max/min value of the vector, or returns the max/min value of each column in a matix.
• Slide 8
• Some useful Array functions
• Slide 9
• [m,l] = max(x)/min(x): returns the max/min values into m and their locations into l.
• Slide 10
• Some useful Array functions size(x): returns the number of rows and number of columns of a matrix x. sort(x): sorts each column of x.
• Slide 11
• Exercise For the matrix B shown below, use MATLAB to (a) find the largest and smallest element in B and their indices and (b) find the array resulted from the operation B([1 2 1],[2 3])
• Slide 12
• Exercise
• Slide 13
• Slide 14
• Element-by-Element Operations SymbolOperationFormExample +/- Scalar-array addition/subtractionA +/- b[6 3] + 4 = [10 7] Array-array addition/subtractionA +/- B[6 3] - [2 1] = [4 2].* Array-array multiplicationA.* B[3 9].*[4 1] = [12 9] * Scalar-array multiplicationa*B3*[7 2] = [21 6]./ Array-array right division Scalar-array right division A./B a./B [5 2]./[10 1] = [0.5 2] 9./[3 9] = [3 1].\ Array-array left division Scalar-array left division A.\B a.\B [5 2].\[10 1] = [2 0.5] 3.\[9 3] = [3 1] / or \ Array-scalar divisionA/b or b\A[12 6]/3 = [4 2] 3\[12 6] = [4 2].^ Array exponentiationA.^B a.^B B.^a [2 3].^[3 2] = [8 9] 2.^[3 2] = [8 4] [2 3].^2 = [4 9]
• Slide 15
• Vectors applications A train is heading east at 60 m/h. A car is heading northeast at 45 m/h as shown. What is the velocity and speed of the train relative to the car?
• Slide 16
• Vectors applications
• Slide 17
• Example The maximum height of an object thrown at angle is given by the Newtons law as a function of the angle and the initial speed v: Create a table showing the maximum height for the following values of v and v = 10, 12, 14, 16, 18, 20 = 50, 60, 70, 80
• Slide 18
• Example
• Slide 19
• Matrix Multiplication