A Script is nothing but, a computer program written in the language of MATLAB. It is stored in an M- file. It is saved with extension .m. We can display the contents of the script in the Command Window using the type command followed by file name without .m extension. Interpreter is a computer program which executes the statements of script step by step. The script can be executed, or run, by simply entering the name of the fi le (without the .m extension) in the command window. MATLAB ignores the comment lines and does not execute when we run the M-fi le.
For example:

% Show the original input, and that its frequency response is what we expect.

plotlength = 500;

plot(n(1:plotlength),input(1:plotlength));

H = fft(input);

mag = sqrt(real(H).^2 + imag(H).^2);

phase = atan2(imag(H),real(H));

freq_axis = pi.*n./length;

freq_length = length/2;

Note that type command is helpful to see the contents of the script in the Command Window. For eample:

% Show the original input, and that its frequency response is what we expect.

plotlength = 500;

plot(n(1:plotlength),input(1:plotlength));

H = fft(input);

mag = sqrt(real(H).^2 + imag(H).^2);

phase = atan2(imag(H),real(H));

freq_axis = pi.*n./length;

freq_length = length/2;

To run the script, the name of the le is entered at the prompt (again, without the .m) or press F5.

The simplest output function in MATLAB is disp, which is used to display the result of an expression.
For example:
In the Command Window,

</p>
&gt;&gt; disp('Hello')
Output:
Hello

In the Command Window,

&gt;&gt; disp(4^3)
Output:
64

fprintf() displays the values of several variables in a speci fied format. For example:
In the Command Window,

&gt;&gt;a= [1 2 3 4 5];
&gt;&gt; fprintf('%d',a)
Output:
12345