1-2 | Matlab stuff Flashcards
Creating matrices:
brackets to use?
square [ ]
Creating matrices
separator for columns?
space or comma
Creating matrices
separator for rows?
;
Matlab function for the reduce row echelon form?
rref()
Matlab function for the rank of a matrix?
rank()
sum of a vector A
sum(A)
Define the vector C = [1, 2, …, 1030]
C = 1:1030
Read out the first three and the last thirty elements of C = [1, 2, …, 1030], such that you obtain a new vector X = [1,2,3,1001,1002,…,1030].
X = C([1:3 end-29:end])
or
X = C([1:3 1001:1030])
Read out all the even elements (divisible by 2) of C = [1, 2, …, 1030]. You can use functions such as mod or rem to find even elements.
C(mod(C,2)==0)
or
C(find(mod(C,2)==0))
Replace the fifth, sixth, …, twelfth elements of C = [1, 2, …, 1030] with the vector [10,15,….,45].
C(5:12) = 10:5:45
Remove all variables from your workspace.
clear
Create a zero vector with 1 row and 10 columns
zeros(1,10)
Create a vector B = [-21, -20, …, -12]
B = -21:-12
Create a vector A = [2, 4, 6,…,20]
A = 2:2:20