Some commands that might be useful for your assignments: >> help sum % Displays information about how the 'sum' function works. Replaces 'sum' with any function for information on how it works. >> lookfor string % Displays a list of functions that have 'string' in their description. >> load file.mat % Load the file 'file.mat', containing variables previously saved by the "save" command. >> i = 37; >> x = X(i) % If X is a vector, assigns x to the 37th element. >> i = 37; >> j = 56; >> x= X(i,j) % If X is a matrix, assigns x to the value of the 56th column of the 37th row. >> k = 102 >> x = X(k) % If X is matrix, sets x to element 'k' of the matrix. The elements are first ordered by columns, then by rows. >> j = 56; >> x = X(:,j) % Creates a column vector out of the 56th column. >> i = 37; >> x = X(i,:) % Creates a row out of the 37th row. >> x = X(:) % Creates a vector by concatenating all the values in the matrix X (it goes through columns, then rows) >> length(x) % Returns the number of elements in a vector x. >> [n,d] = size(X) % Returns the number of rows in a matrix in 'n' and the number of columns in 'd'. >> x = ones(n,d) % Creates a matrix of size n by d, where every element is set to 1. >> x = zeros(n,d) % Creates a matrix of size n by d, where every element is set to 0. >> x = 1:n % Creates a row vector containing the values 1,2,3,...,n. >> X1 = X(1:n,:) % Creates a new matrix from the first 1 through n rows of X. >> X2 = X(n:end,:) % Creates a new matrix from rows n through to the last row of X. >> sum(X) % Computes the sum of all elements of X. >> max(X) % If X is a vector, returns the largest element. If X is a matrix, returns the maximum of each column. Use "min" for finding smallest elements. >> [maxVal,maxInd] = max(X) % This returns two arguments. The first, 'maxVal', is the output of the maximum function. The second, 'maxInd', is the index of the maximal element. >> unique(X) % Returns all unique (non-identical) elements of X. >> mode(X); >> mean(X); >> median(X); >> std(X); % If X is a vector, computes the mode/mean/median/standard-deviation of the vector. If X is a matrix, does this for each column. >> quantile(X,p) % Returns quantile 'p' of X, where 0 <= p <= 1. >> ind = find(X==1) % Returns the indexes of all elements of the vector X, where X(i) = 1. >> i =1 >> j = 2 >> ind = find(X(:,j)==1) >> mean(X(ind,i)) % Computes the mean of all values in column 'i', that have column 'j' equal to one. >> plot(x,y) % Makes a basic line plot with the values of x as the x-axis and the values of y on the y-axis. >> hist(x) % Makes a histogram of the values in the vector x. >> scatter(x,y,size,categories) % Makes a scatterplot, with the values of x giving the x-locations, the values of y giving the y-locations, size giving the size of the points, and categoires giving the labels used to assign colors. >> boxplot(y,x) % Makes a boxplot, where x gives the categories and y gives the values. >> x = A\b % Sets x to a solution (if one exists) of Ax =b.