Presentation is loading. Please wait.

Presentation is loading. Please wait.

Announcements.

Similar presentations


Presentation on theme: "Announcements."— Presentation transcript:

1 Announcements

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

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

4 Matrix Addressing >> disp(matrixFour) 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;

5 Matrix Addressing (Cont)
Colon (:) means “all” or range >> disp(matrixFour) >> disp(matrixFour(:,4)) 9 11 >> disp(matrixFour(2,:))

6 Matrix Addressing (Cont)
>> disp(matrixFour) >> disp(matrixFour(:,2:5))

7 Matrix Scalar Operations
>> disp(matrixFour) >> disp(matrixFour + 2) >> disp(matrixFour * 2)

8 Matrix Vector Multiplication
Number of Cols in Matrix *Must* Equal Number of Rows in Vector >> matrixOne = [1,2,3;4,5,6]; >> vectorOne = [2;2;2]; >> disp(matrixOne); >> disp(vectorOne); 2 >> disp(matrixOne * vectorOne); 12 30

9 Matrix Matrix Multiplication
Number of Cols in Left Hand Matrix *Must* Equal Number of Rows in Right Hand Matrix >> disp(matrixOne); >> vectorOne = [2;2;2]; >> matrixTwo = [vectorOne, vectorOne * 2]; >> disp(matrixTwo); >> disp(matrixOne * matrixTwo);

10 Matrix Matrix Multiplication
Number of Cols in Left Hand Matrix *Must* Equal Number of Rows in Right Hand Matrix >> disp(matrixOne); >> disp(matrixTwo); >> disp(matrixTwo * matrixOne);

11 >> matrixTwo = [matrixTwo; [1,1]];
>> disp(matrixTwo); >> disp(matrixOne); >> disp(matrixTwo * matrixOne); >> disp(matrixOne * matrixTwo); Error using * Inner matrix dimensions must agree.

12 >> matrixThree = [2,2;1,1];
>> disp(matrixThree); >> matrixFour = [3,4;5,6] >> disp(matrixFour); >> disp(matrixThree .* matrixFour); >> disp(matrixThree * matrixFour);

13 Matrix Exponenent >> disp(matrixTwo) 1 2 3 4 5 6 7 8 9
>> disp(matrixTwo.^2) >> disp(matrixTwo^2)

14 Matrix Functions >> disp(matrixFive); 9 3 5 0 8 -9 11 16
>> disp(sum(matrixFive)) >> disp(sum(sum(matrixFive))) 43

15 Matrix Functions >> disp(matrixFive); 9 3 5 0 8 -9 11 16
>> disp(max(matrixFive)); >> disp(min(matrixFive)); >> disp(max(max(matrixFive))); 16

16 Matrix Functions >> disp(matrixFive); 9 3 5 0 8 -9 11 16
>> disp(length(matrixFive)) 4 >> disp(size(matrixFive)) >> disp(sort(matrixFive))

17 Matrix Functions >> disp(vectorOne); 1 2 3 4 5 6 7 8 9 10
>> disp(vectorTwo); >> plot (vectorOne, vectorTwo)

18 >> disp(vectorOne);
>> disp(vectorTwo); >> plot (vectorOne, vectorTwo)

19 More MatLab Plotting Setting Axes, Grid Marks Labels
Plotting Functions Labeling Files Data Files Spreadsheet Files Statistics, Probablity, Higher Math Random Numbers Normal Distribution Linear Equations Calculus


Download ppt "Announcements."

Similar presentations


Ads by Google