Three Components of a Graph:
- Figure window: display the graph
- Coordinate system: so that graph is placed within axis, which are contained by the Figure
- other graph objects: lines and surfaces
Basic Plotting Commands:
- plot: graph 2-D data with linear scales for both axes
- plot3: graphe 3-D data with linear scales for both axes
- loglog, semilogx, lemilogy, plotyy et al.
Plotting Steps:
- Preparing the data [x = 0:0.1:1; y = bessel(1,x);]
- Select a window and position a plot region within the window [figure 1; subplot(2,2,1);]
- Call elementary plotting function [h = plot(x,y)]
- Select line and marker characters [set(h, 'LineWidth', 2, {'LineStyle'}, {'--'} ]
- Set axis limit, tick marks, and grid lines [axis ([0 12 -0.5 1]); grid on;]
- Annotate the graph with axis labels, legend and text [xlabel('Time'); legand(h, 'First')]
- export graph [ print -depsc -tiff -r200 myplot]
The Figure Window:
- MATLAB directs graphics output to a window separated from command window, which is refereed to as Figure
- Graphics functions automatically create new figure windows if none currently exist. If a figure already exists, MATLAB uses that window.
These are some of the most common matlab graphic process, and there are other specialized figures, such as contour, histogram, et al, which I will not detailed them here.
No comments:
Post a Comment