MATLAB Commands
ctrl + c stop the execution of the current command
clc clear the command window
clear x remove the variable x
clear all remove all the variables
whos show a list of all the variables
, indicate the end of a command
indicate the end of a command and suppress printing
;
mark the end of a row in a matrix
... continue the command in the next line
format compact hide the blank lines
format loose show the blank lines
format long show the numbers in 15 digits
format short show the numbers in 5 digits
help get information about anything in the MATLAB
lookfor remember the correct name of a command
% make a one-line comment
%{
make a multi-line comment
%}
figure make a new figure window
close close the last figure window
close all close all the figure windows
imread() make a 3d array to store a picture
image() display a picture
truesize causes each value in the 3d array to be displayed by exactly one pixel
axis off remove axis from the figure window
size() show the dimensions of a matrix
x:y:z make array starts with x and increases by y and doesn’t exceed z
x:z make array starts with x and increases by 1 and end with z
array( : , x ) ‘ : ‘ means all the rows
array( x , : ) ‘ : ‘ means all the columns
array ( end , x ) ‘end’ means the last row
array ( x , end ) ‘end’ means the last column
array( [ x y ] , z ) the elements of z column located in the x and y rows
array( x , [ y z ] ) the elements of the x column located in the y and z rows
horizontal combination of 3 arrays have the same dimensions
[ A1 A2 A3 ] horizontal combination of 3 arrays have the same number of rows
horizontal combination of 3 arrays have the same number of columns
vertical combination of 3 arrays have the same dimensions
[ A1 ; A2 ; A3 ] vertical combination of 3 arrays have the same number of rows
vertical combination of 3 arrays have the same number of columns
transpose of a matrix
‘
get the complex conjugate of a complex number
transpose of a matrix includes complex numbers
.’
without getting the conjugates of the complex numbers
+ addition of elements of arrays have the same dimensions
- subtract of elements of arrays have the same dimensions
* matrix multiplication
.* array multiplication ( multiplication of element by element )
A ./ B array division ( A elements over B elements )
A .\ B array division ( B elements over A elements )
A/B matrix division
A .^ B array exponentiation ( A elements power to B elements )
A+c addition of the constant c to each element of the array A
A-c subtract of the constant c from each element of the array A
A*c multiplication of the constant c by each element of the array A
A/c multiplication of the elements of the array A by the constant c
circshift( A, x ) shift the array A columns by x
circshift(A, [ x y ]) shift the array A columns by x and rows by y
repmat( A , x , y) repeat the matrix A in the dimension of x a number of y copies
array( : ) column vector of the elements of the array
reshape(A, x, y ) rearrange the elements of array A in the dimensions of [ x , y ]
rand(n) create an n by n matrix of random numbers between 0 and 1
rand(x,y) create an x by y matrix of random numbers between 0 and 1
function the full formal definition of a function
[out1,out2] =
func( in1 , in2 ) to ignore an output put ~ in its place
exist x check the existence of a function called x