Table B.2 Color options
Symbol
Color
y
yellow
m
magenta
c
cyan
r
red
g
green
b
blue
w
white
k
black
Plots may be annotated with title, xlabel, and ylabel commands. For
example,
plot(n, xn);
title(`Time-domain signal x(n)');
xlabel(`Time index');
ylabel(`Amplitude');
where title gives the plot with the title `Time-domain signal x(n)', xlabel labels the
x-axis with `Time index' and ylabel labels the y-axis with `Amplitude'. Note that these
commands can be written in the same line.
By default, MATLAB automatically scales the axes to fit the data values. However,
we can override this scaling with the axis command. For example, the plot statement
followed by
axis([xmin xmax ymin ymax]);
sets the scaling limits for the x- and y-axes on the current plot. The axis command
must follow the plot command to have the desired effect. This command is especially
useful when we want to compare curves from different plots using the identical scale.
The axis command may be used to zoom-in (or zoom-out) on a particular section of
the plot. There are some predefined string-arguments for the axis command. For
example,
axis(`equal');
sets equal scale on both axes, and
axis(`square');
sets the default rectangular graphic frame to a square.
The command plot(x,y)assumes that the x and y axes are divided into equally
spaced intervals; these plots are called linear plots. The MATLAB commands can also
generate a logarithmic scale (base 10) using the following commands:
456
APPENDIX B: INTRODUCTION OF MATLAB FOR DSP APPLICATIONS