DSP Using Matlab® - 2
DSP Using Matlab® - 2
g Green S Star
b Blue d Square
w White v Diamond
k black ^ Triangle
< Triangle
> Triangle
p Pentagra
h m
hexagra
Plotting Styles
Example:
>> x1=linspace(0,2*pi,10);
>> x2=linspace(0,2*pi,50);
>> x3=linspace(pi,2*pi,100);
>> x4=linspace(pi/3,2*pi,150);
>> y1=sin(x1);
>> y2=cos(x2);
>> y3=abs(sin(x3));
>> y4=sin(x4).*sin(x4);
>> plot(x1,y1,'gs', x2,y2,'kp:', x3,y3, x4,y4,'r--');
>> legend('sin(x)', 'cos(x)', 'abs(sin(x))', '(sin(x)*sin(x))',3)
>> xlabel('x - Radians');
>> title('Various Trigonometric Functions');
Plotting Styles
Example:
Plotting Styles
Change
background
colour use
“whitebg”.
This toggles
between
white and
black
background
Change back
to white type
“whitebg(‘w’
)”.
Plotting Styles
Place grid on
the current
plot.
Add “grid
on” on the
end of the
last
example.
Type”grid
off” to
remove grid.
Plotting Styles
To set the axis, use “axis” command.
axis ([Xmin Xmax Ymin Ymax]) – this
form specifies min and max limits for the
x- and y-axes.
axis auto – This form returns the axis
control back to matlab and allows matlab
to choose the axes limits automatically
You can use the “axis” to zoom to a
specific portion of the plot. Try this.