Thus far we have shown the interactive features of MATLAB by entering one command at a time. One reason that MATLAB is powerful is that it is a language, and programs of MATLAB code can be saved for later use. There are two ways of generating your own MATLAB code: script files and function routines.
A script file is simply a sequence of commands that could have been entered interactively in the MATLAB command window. When the sequence is long or must be performed a number of times, it is much easier to generate a script file.
The following example is for the so-called quadratic map (population model)
where xk represents ...