2-D Graphics - Chapter 26 2-D Graphics 26.1 The plot...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 26 2-D Graphics 26.1 The plot Function The basic function for producing 2-D graphs is the MATLAB ' plot ' function. It is generally called with two identically sized row (or column) vectors, one for the set of abscissa values and the second for the ordinate axis. The plotted points are ordered pairs of values, one from the first vector and one from the second vector. For example, to plot the points 1 1 2 2 ( , ), ( , ), . ...., ( , ) n n x y x y x y the arrays x= [ ] 1 2 , , ..... , n x x x and y= [ ] 1 2 , , ..... , n y y y are created and then passed to the plot function for graphing. Example 26.1.1 x=[0 2 5 8 10]; % Create x vector y=[0 4 -3 -3 6]; % Create y vector plot(x,y) % Plot (0,0), (2,4), (5,-3), (8,-3), (10,6) When the ' plot' command is issued within an m-File or from the Command window, MATLAB opens a new Figure window, draws a set of axes automatically scaled to fit the data, plots the points in the order in which they appear in the two vectors, and then connects all the points by straight lines. Numerical scales appear on both axes as do tick marks. The '
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

2-D Graphics - Chapter 26 2-D Graphics 26.1 The plot...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online