MATLAB Basics Review


Variable assignment

varName = expression

How assignment works

LHS    =    RHS

 

Naming rules

 

 

 

 

 

 

Naming conventions

 

 

 

 


What vector does each of the following create?

a = 2 : 7


b = [ 1 : 2 : 11 ]


c = -4 : 3 : 10 



d = 10 : 2 : 1 



e = [ c , a ]



Trace the execution of the following code

vec = [ 5 2 1 6 3 ]


vec(1, 3) = 4


vec(8) = 9


vec(2:4) = -1








What matrices are created by the following?

mat = [ 11:15 ; 21:25 ; 31:35 ]




mat( 1, : )



mat( [ 1 2 ], 3 )



mat( [ 2 3 1 ], [ 4 1 5 ] )











Scripts