1/52
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Scalar
A single number
Row Vector
Rows by columns i.e. 1×4
Brackets [] and commas ,
How to create a row vector
Column Vector
A group of numbers organized vertically i.e 4×1
Semicolon ; and apostrophe ‘
How to create column vector and transpose matrix
Transpose Matrix
Swapping (i,j) for (j,i)
Matrix
Rows by Columns
Hardcoding Arrays
There should be consistent rows or columns i.e 4×3 not 4×2 and 3×1
Size()
Dimensions of an array
How to use Size()
2 outputs (row and column) or 2 inputs (array, 1 for rows or 2 for columns)
Length()
Finds the maximum of rows or columns; whichever is greater
How to use Length()
1 output needed (i.e only include the Matrix)
Sum()
Finds the sum of array elements
Sum(Matrix3,1)
Sum of all rows
Sum(Matrix3,2)
Sum of all columns
Sum(sum(Matrix3,1)
Sum of all elements
min()
Finds the minimum element within an array
min(Matrix3,[],1)
minimum of each row
min(Matrix3,[],2)
minimum of each column
min(min(Matrix3,[],1))
minimum of whole matrix
max()
Finds the maximum of an array
max(Matrix3,[],1)
finds the max of a row
max(Matrix3,[],2)
Finds the max of a column
max(max(Matrix3,[],1))
Finds the max of a matrix
[H_Value, H_Location] = max(Vector)
Return maximum value and location
[L_Value, L_Location = min(Vector)
Return minimum value and location
Matrix Addition
Can hardcode a number to add or add 2 matrices together
C= A + B
A = [1,2,3,4]
B = [5,6,7,8]
Add together to “C”
AddTest = Matrix4 + [1,2]
Add 1 value to Matrix row, 2 values to Matrix column
M_test_2 = Matrix4 .* [1,2]
Elementwise multiplication
Slicing (Element)
A1=A(2,4)
Slicing(Row)
A1=A(:,2)
Slicing(Column)
A1=A(3,:) or A1=A(3,[1:end])
Slicing(Rows and Columns)
A1=A(1:2,1:4)
Augment Arrays
brackets [] and commas , or brackets and semicolons
Arrays Dimnution
G(:,3) = []
A=zeroes(2,3) and B=ones(2,3)
zeroes and ones functions
Traversing Arrays
Moving through an array element by element
Traversing Format (Vector)
One for loop, if statement depends on if conditions need to be met
Traversing Format (Matrix)
2 for loops, if statements dependent on if conditions need to be met
Referencing
Use one for loop inside of another to use 2 different values
plot(x,y,’linespec’)
Plotting
hold on, hold off
2 plots
title(‘titleL’)
Title
xlabel(‘x’)
X axis label
ylabel(‘y’)
Y axis label
ylim[,] and xlim[,]
Axis limits
legend(‘x’,’y’)
Graph legend
y=linspace(x1,x2,n)
Plotting Functions
X1
Starting value of sequence
X2
Ending value of sequence
n
number of points to generate
subplot(row, column, position)
Subplot formula