Graphics Reference
In-Depth Information
5.3 Steps to Graphing Data
As we have seen, the Basic module of MATLAB offers a wide range of options when it comes to graphic
representations. It allows graphs of planar curves and surfaces, enabling grouping and overlapping. It is also possible
to work colors, grids, frames, etc., into the graphics. Representations of functions can be in implicit, explicit and
parametric coordinates. MATLAB is therefore mathematical software with high graphics performance, distinguishing
it from many other symbolic calculation packages. MATLAB also allows graphics of bars, lines, stars, histograms,
polyhedra, geographical maps and animations. The creation of a graph is usually attached to the following steps:
Step
Example
x = 0:0.2:12; Y1 = besselj(1,x);
Y2 = besselj(2,x); Y3 = besselj(3,x);
Prepare the data
figure(1); subplot(2,2,1)
Choose the window and locate the position
h = plot(x,Y1,x,Y2,x,Y3);
Use a graphic function
set(h,'LineWidth',2,{'LineStyle'});
set(h,{'Color'},{'r';'g';'b'})
Choose lines and markercharacteristics (width, colors,...)
axis([0,12,-0.5,1]) grid on
Position limits of axes, marks and mesh
xlabel('Time'); ylabel('Amplitude')
legend(h,'First','Second','Third')
title('Bessel Functions')
[y,ix] = min(Y1);
Place annotations, labels, and legends
print -depsc -tiff -r200 graphname
Export the graph
5.4 Steps to Perform 3 -D Graphics
The Basic module of MATLAB allows graphics in three dimensions, both lines and nets and surfaces. You can also
use explicit and parametric coordinates. The steps followed in general to carry out a three-dimensional graph are
presented in the following table:
Step
Example
Z = peaks(20);
1.
Prepare the data
figure(1)
subplot(2,1,2)
2.
Select the window and position
h = surf(Z);
3.
Use a 3-D graphic function
colormap hot
shading interp
set(h,'EdgeColor','k')
4.
Place color and shadow
light('Position',[-2,2,20])
lighting phong
material([0.4,0.6,0.5,30])
set(h,'FaceColor',[0.7 0.7 0],...
'BackFaceLighting','lit')
5.
Add lighting
( continued )
 
Search WWH ::




Custom Search