for variable = expressionstatementsend
The columns of thefor variable = expressionstatement...statementend
expression are stored one at a time in the variable while the following statements, up to the end, are executed.
In practice, the expression is almost always of the form scalar : scalar, in which case its columns are simply scalars.
The scope of the for statement is always terminated with a matching end.
n has already been assigned a value. Create the Hilbert matrix, using zeros to preallocate the matrix to conserve memory:
Stepa = zeros(n,n) % Preallocate matrixfor i = 1:nfor j = 1:na(i,j) = 1/(i+j -1);endend
s with increments of -0.1
Successively setfor s = 1.0: -0.1: 0.0,...,end
e to the unit n-vectors:
The linefor e = eye(n),...,end
has the same effect asfor V = A,...,end
exceptfor j = 1:n,V = A(:,j);..., end
j is also set here.
break,end,if,return,while
(c) Copyright 1994 by The MathWorks, Inc.