creating scalars, vectors, matrices ex1 & 2. dot product & cross product ex3. plotting...
TRANSCRIPT
![Page 1: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/1.jpg)
Creating scalars, vectors, matricesEx1 & 2. Dot Product & Cross Product
Ex3. Plotting Graphs
Ex4. Conversion Table
Ex5. Plotting functions
Finishing Ex4.
Ex6 and Ex7. Use of matrices in real world
Creating Arrays
11
![Page 2: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/2.jpg)
1. Creating scalars
Assign a value to a variable (i.e. Hardcode)pressure = 10; %pascals
temperature = 298; %kelvin
Store the result of an equationpressure = density*R*temperature;
Save the return-value of the input() commandage = input(‘Enter your age: ’);
22
![Page 3: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/3.jpg)
2. Creating vectors
There are LOTS of ways to create vectors, based on three simple ideas:
The values in the vector are pre-defined. For example:
[ 2 -5 4.4 -96.6]
33
![Page 4: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/4.jpg)
2. Creating vectors
There are LOTS of ways to create vectors, based on three simple ideas:
The values in the vector are pre-defined. For example:
[ 2 -5 4.4 -96.6]
The values have a pattern (addition only). For example:
[10, 20, 30 ,…100] or [-10 -8 -6 -4 -2 0]
44
![Page 5: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/5.jpg)
2. Creating vectors
There are LOTS of ways to create vectors, based on three simple ideas:
The values in the vector are pre-defined. For example:
[ 2 -5 4.4 -96.6]
The values have a pattern (addition only). For example:
[10, 20, 30 ,…100] or [-10 -8 -6 -4 -2 0]
Finally, the total amount of values is known. For example:
25 points evenly spaced from 0 to 100.
55
![Page 6: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/6.jpg)
2.1. Pre-defined values
66
![Page 7: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/7.jpg)
77
2.1. Pre-defined values, cont.
![Page 8: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/8.jpg)
88
2.1. Pre-defined values, cont.
![Page 9: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/9.jpg)
99
What else are semi-colons used for?
2.1. Pre-defined values, cont.
![Page 10: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/10.jpg)
1010
What else are semi-colons used for?
They create rows AND suppress output!
2.1. Pre-defined values, cont.
![Page 11: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/11.jpg)
1111
What else are semi-colons used for?
They create rows AND suppress output!
The apostrophe allows to transpose a vector. Rows become columns. Columns become rows.
2.1. Pre-defined values, cont.
![Page 12: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/12.jpg)
1212
What else are semi-colons used for?
They create rows AND suppress output!
The apostrophe allows to transpose a vector. Rows become columns. Columns become rows.
What dimension will speeds have? _______________________________
2.1. Pre-defined values, cont.
![Page 13: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/13.jpg)
Ex1. Dot product
Remember the DOT product? (maybe/maybe not)
13
Credits to: http://www.itee.uq.edu.au/~cogs2010/cmc/chapters/Hebbian/ten5.gif
The DOT product…
![Page 14: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/14.jpg)
Ex1. Dot product
Remember the DOT product? (maybe/maybe not)
14
Credits to: http://www.itee.uq.edu.au/~cogs2010/cmc/chapters/Hebbian/ten5.gif
In Matlab
The DOT product…
![Page 15: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/15.jpg)
* * * * * *
Ex2. Cross product
How about the CROSS product? (maybe/maybe not)
15
Source: http://www.math.umn.edu/~nykamp/m2374/readings/crossprodex/
Source: Wikipedia
The CROSS product…
![Page 16: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/16.jpg)
Cross product, cont.
16
In Matlab
![Page 17: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/17.jpg)
Ex3. Plotting graphs
In order to plot, Matlab needs data points:
17
x y
-7
-2
3
8
4
-7
3
-1
x
y
![Page 18: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/18.jpg)
Ex3. Plotting graphs
In order to plot, Matlab needs data points:
18
x y
-7
-2
3
8
4
-7
3
-1
x
y
![Page 19: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/19.jpg)
Ex3. Plotting graphs
In order to plot, Matlab needs data points:
19
x y
-7
-2
3
8
4
-7
3
-1
x
y Matlab connects the dots!
![Page 20: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/20.jpg)
Ex3. Plotting graphs
In order to plot, Matlab needs data points:
Well… x is an array of data points x = [-7 -2 3 8] y is another array of data points y = [4 -7 3 -1] …for the curious ones, to plot: plot(x,y)
20
x y
-7
-2
3
8
4
-7
3
-1
x
y
![Page 21: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/21.jpg)
2.2. Patterns (addition only)
2121
The range operator
Numbers are separated by +1
![Page 22: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/22.jpg)
2222
The range operator
Numbers are separated by +1An additional value in the middle specifies the increment.
+3 +3 +3 +3 +3 +3 +3 +3 >32
2.2. Patterns, cont.
![Page 23: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/23.jpg)
2323
The range operator
Numbers are separated by +1An additional value in the middle specifies the increment.
+3 +3 +3 +3 +3 +3 +3 +3 >32
-2.5 -2.5 -2.5 < 3
Go reverse by using a negative increment! CAUTION: the beginning number must be > the end number. Here 10>3. (This also shows it works with decimals.)
2.2. Patterns, cont.
![Page 24: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/24.jpg)
2424
The range operator
Numbers are separated by +1An additional value in the middle specifies the increment.
+3 +3 +3 +3 +3 +3 +3 +3 >32
-2.5 -2.5 -2.5 < 3
To use the apostrophe and create a column vector, absolutely place brackets first!
… else….
2.2. Patterns, cont.
![Page 25: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/25.jpg)
2525
The range operator
Numbers are separated by +1An additional value in the middle specifies the increment.
+3 +3 +3 +3 +3 +3 +3 +3 >32
-2.5 -2.5 -2.5 < 3
To use the apostrophe and create a column vector, absolutely place brackets first!
… else….
Only the scalar -10 gets transposed: but a scalar transposed remains the same scalar!
2.2. Patterns, cont.
![Page 26: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/26.jpg)
Ex4. Conversion table
% create celsius data points
celsius = 0:10:100; %0 to 100 by +10 increment
% calculate Fahrenheit
fahrenheit = celsius * 9/5 + 32;
% show table
<code not shown>
26
![Page 27: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/27.jpg)
2.3. Specific amount of data points
A built-in function called linspace() spaces elements linearly in an array. What does this mean?
The distance between each consecutive data point is equal.
There are two ways to use it, as Matlab ‘hints’ when the command typed is unfinished:
2727
Either provide 2 arguments, or provide 3 arguments.
![Page 28: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/28.jpg)
2.3. linspace(), cont.
2828
The third argument indicates the ________________________ .
![Page 29: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/29.jpg)
2929
The third argument indicates the ________________________ .
When Matlab cannot display all the elements on one line, it simply indicates the column-number per line.
2.3. linspace(), cont.
![Page 30: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/30.jpg)
3030
The third argument indicates the ________________________ .
When Matlab cannot display all the elements on one line, it simply indicates the column-number per line.
2.3. linspace(), cont.
![Page 31: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/31.jpg)
31
?????? %no third argument
Omit the third argument uses a default of _______ data points!
2.3. linspace(), cont.
![Page 32: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/32.jpg)
Ex5. Plotting graphs
Suppose a function that relates each x to its y-coordinate is known: y = f(x) = x2. Plot y vs. x.
32
![Page 33: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/33.jpg)
Ex5. Plotting graphs
Suppose a function that relates each x to its y-coordinate is known: y = f(x) = x2. Plot y vs. x.
In this case, it is tedious work to hard-code each x and y array. Are 4 data-points sufficient, like in example 3?
33
x
y x y
-10
-5
5
10
100
25
25
100
![Page 34: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/34.jpg)
Ex5. Plotting f(x) = x^2, cont.
Remember: which built-in function influences the number of data-points in an array?____________________
In this case:%array x of 20 data points
%calculate array of y’s.
%plot command
And the result is…34
![Page 35: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/35.jpg)
Ex5. Plotting f(x) = x^2, cont.
Remember: which built-in function influences the number of data-points in an array?____________________
In this case:%array x of 20 data points
x = linspace(-10,10,20);
%calculate array of y’s.
y = x.^2; %(The dot will be explained next time…)
%plot command
plot(x,y)
And the result is…35
![Page 36: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/36.jpg)
Ex5. Plotting f(x) = x^2, cont.
36
Does this represent f(x) = x2 ?
Yes Or No
Yes, but it took 20 points!!
![Page 37: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/37.jpg)
Ex5. Plotting f(x) = x^2, cont.
The use of linspace() in this example is crucial! Why do all 20 data point need to be linearly spaced?
What would happen otherwise?
37
Still 20 points!!
.. but the first 19 are before -5,
.. and the last one is 10.
Not f(x) = x2..
![Page 38: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/38.jpg)
3. Creating Matrices
Simply a combination of all symbols introduced with vectors! Square brackets [ ] Spaces or commas , , Semi-colons ; Apostrophes ’
3838
![Page 39: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/39.jpg)
3.1. Matrices: hard-coding
3939
Use semi-colons to create new rows.
ONLY rectangular matrices:The number of columns MUST match for each row, and vice-versa.
![Page 40: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/40.jpg)
4040
Use semi-colons to create new rows.
ONLY rectangular matrices:The number of columns MUST match for each row, and vice-versa.
Use previous matrices to actually create new matrices.
This example transposes the matrix variable a.
3.2. Reusing Previous matrices
![Page 41: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/41.jpg)
4141
Use semi-colons to create new rows.
ONLY rectangular matrices:The number of columns MUST match for each row, and vice-versa.
You can use previous matrices to actually create new matrices.
This example transposes the variable a.
Combine any previous methods, AS LONG AS the matrix remains rectangular.
3.3. Using Colons
![Page 42: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/42.jpg)
3.4. “Concatenating”
4242
Use semi-colons to create new rows.
ONLY rectangular matrices:The number of columns MUST match for each row, and vice-versa.
You can use previous matrices to actually create new matrices.
This example transposes the variable a.
You can combine any previous methods, AS LONG AS the matrix remains rectangular.
Finally, create arrays by combining previous variables!
This is called CONCATENATING.
![Page 43: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/43.jpg)
4343
Use semi-colons to create new rows.
ONLY rectangular matrices:The number of columns MUST match for each row, and vice-versa.
You can use previous matrices to actually create new matrices.
This example transposes the variable a.
You can combine any previous methods, AS LONG AS the matrix remains rectangular.
When the array becomes too big, the numbers no longer display.
3.5. Using the command window
![Page 44: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/44.jpg)
Ex4. Conversion table, end!
% create celsius data points
celsius = 0:10:100; %0 to 100 by +10 increment
% calculate Fahrenheit
fahrenheit = celsius * 9/5 + 32;
% show table
[celsius’ fahrenheit’]
44
![Page 45: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/45.jpg)
Ex6. Sling Thermometer
45
A method to read relative-humidity.
![Page 46: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/46.jpg)
Ex7. Images
46
Each row and column have a pixel value stored.
![Page 47: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/47.jpg)
Wrapping Up Know by heart each way to create a row/column vector.
Hard-code each data point Separate each data-point by comma or spaces for row vector Separate each data-point by semicolon for a column vector
Shortcut when there is an addition pattern (colon) Shortcut when a specific amount of data points are linearly
spaced (linspace())
47
![Page 48: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/48.jpg)
Wrapping Up Know by heart each way to create a row/column vector.
Hard-code each data point Separate each data-point by comma or spaces for row vector Separate each data-point by semicolon for a column vector
Shortcut when there is an addition pattern (colon) Shortcut when a specific amount of data points are linearly
spaced (linspace())
Realize that creating matrices only requires combining all of the above, while respecting one crucial rule: A matrix must remain rectangular at all times (i.e. no holes within
the matrix)
48
![Page 49: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/49.jpg)
Wrapping Up Know by heart each way to create a row/column vector.
Hard-code each data point Separate each data-point by comma or spaces for row vector Separate each data-point by semicolon for a column vector
Shortcut when there is an addition pattern (colon) Shortcut when a specific amount of data points are linearly
spaced (linspace())
Realize that creating matrices only requires combining all of the above, while respecting one crucial rule: A matrix must remain rectangular at all times (i.e. no holes within
the matrix)
What does the apostrophe do?
49
![Page 50: Creating scalars, vectors, matrices Ex1 & 2. Dot Product & Cross Product Ex3. Plotting Graphs Ex4. Conversion Table Ex5. Plotting functions Finishing Ex4](https://reader035.vdocuments.us/reader035/viewer/2022081417/56649e175503460f94b03134/html5/thumbnails/50.jpg)
Wrapping Up Know by heart each way to create a row/column vector.
Hard-code each data point Separate each data-point by comma or spaces for row vector Separate each data-point by semicolon for a column vector
Shortcut when there is an addition pattern (colon) Shortcut when a specific amount of data points are linearly spaced
(linspace())
Realize that creating matrices only requires combining all of the above, while respecting one crucial rule: A matrix must remain rectangular at all times (i.e. no holes within the
matrix)
What does the apostrophe do? Restate some examples of vector operations and matrix
operations. 50