Professional Documents
Culture Documents
Introduction :
The name MATLAB stands for matrix laboratory. MATLAB is produced by
Mathworks .MATLAB was originally written to provide easy access to matrix.
The initial release for Matlab(1984; 36 years ago).
Designed by(Clive Moler).
First appeared(late 1970s).
The command (Clc) : clears the command window and homes the cursor, i.e.
remove all text.
The command (clear) : removes all variables from the workspace .This frees the
up system memory.
The command (close all) : deletes all figures whose handles are not hidden.
Loops type :
There may be a situation when you need to execute a block of code several
times. In general, statements are executed sequentially. The first statement in a
function is executed first, followed by the second, and so on.
Programming languages provide various control structures that allow for more
complicated execution paths.
A loop statement allows us to execute a statement or group of statements
multiple times. The drawing shows the general form of a loop statement for
most programming languages.
Matlab provides various types of loops to handle looping requirements
including: while loops, for loops, and nested loops. If you are trying to declare
or write your own loops, you need to make sure that the loops are written as
scripts and not directly in the Command Window.
To start a new script, locate the button in the upper left corner of the window
labeled New Script .
2
For loop :
A for loop is a repetition control structure that allows you to efficiently write a
loop that needs to execute a specific number of times.
Examples :
(1)
3
(2)
4
(3)
5
Source :
1_
https://www.uwyo.edu/ceas/resources/current-students/classes/esig%20help
/windows%20help%20files/matlab/loop%20types.pdf
2_ https://en.m.wikipedia.org/wiki/MATLAB