1-2, repeat command
The simplest repeat command is for-loop, its basic form:
FOR variable = matrix;
Operation;
end
The value of the variable will be set to each line of the matrix to perform an arithmetic pattern between FOR and END. Therefore, if there is no accident, the number of arithmeters will be equal to the number of rows of the matrix.
For example, the following commands generate a harmonic sequence: Harmonic Sequence:
X = Zeros (1,6);% x is a zero matrix of 16
For i = 1: 6,
X (i) = 1 / i;
<