%% help is a very useful matlab command. So is lookfor %% try 'help' and 'help general' to see what help topics are available. >> help if IF Conditionally execute statements. The general form of an IF statement is: IF variable, statements, END The statements are executed if the real part of the variable has all non-zero elements. The variable is usually the result of expr rop expr where rop is ==, <, >, <=, >=, or ~=. For example: IF I == J A(I,J) = 2; ELSEIF ABS(I-J) == 1 A(I,J) = -1; ELSE A(I,J) = 0; END >> help for FOR Repeat statements a specific number of times. The general form of a FOR statement is: FOR variable = expr, statement, ..., statement END The columns of the expression are stored one at a time in the variable and then the following statements, up to the END, are executed. The expression is often of the form X:Y, in which case its columns are simply scalars. Some examples (assume N has already been assigned a value). FOR I = 1:N, FOR J = 1:N, A(I,J) = 1/(I+J-1); END END FOR S = 1.0: -0.1: 0.0, END steps S with increments of -0.1 FOR E = EYE(N), ... END sets E to the unit N-vectors. %% do 'help lang' for more on flow-of-control constructs. %% do 'help elfun' for more on elementary math functions. %% do 'help ops' for operators and special characters. %% do 'help matfun' for matrix functions. %% %% each of these gives a list of topics for further help; e.g. >> help eig EIG Eigenvalues and eigenvectors. EIG(X) is a vector containing the eigenvalues of a square matrix X. [V,D] = EIG(X) produces a diagonal matrix D of eigenvalues and a full matrix V whose columns are the corresponding eigenvectors so that X*V = V*D. [V,D] = EIG(X,'nobalance') performs the computation with . . .