23.10.2014 Views

Matlab Chapter6.pdf

Matlab Chapter6.pdf

Matlab Chapter6.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1.6.1 Setting Axis Limits<br />

By default, MATLAB finds the maxima and minima of the data and chooses the axis limits to<br />

span this range. The axis command enables you to specify your own limits:<br />

≫ axis([xmin xmax ymin ymax])<br />

or for three-dimensional graphs,<br />

≫ axis([xmin xmax ymin ymax zmin zmax])<br />

Use the command<br />

≫ axis auto<br />

to reenable MATLAB automatic limit selection.<br />

1.6.2 Setting the Axis Aspect Ratio<br />

The axis command also enables you to specify a number of predefined modes. For example,<br />

≫ axis square<br />

makes the x-axis and y-axis the same length.<br />

≫ axis equal<br />

makes the individual tick mark increments on the x-axes and y-axes the same length. This<br />

means<br />

≫ plot(exp(i ∗ [0 : pi/10 : 2 ∗ pi]))<br />

followed by either axis square or axis equal turns the oval into a proper circle:<br />

≫ axis auto normal<br />

returns the axis scaling to its default automatic mode.<br />

1.6.3 Setting Axis Visibility<br />

You can use the axis command to make the axis visible or invisible.<br />

≫ axis on<br />

makes the axes visible. This is the default.<br />

≫ axis off<br />

makes the axes invisible.<br />

1.6.4 Setting Grid Lines<br />

The grid command toggles grid lines on and off. The statement<br />

≫ grid on<br />

turns the grid lines on, and<br />

≫ grid off<br />

turns them back off again. For More Information See the axis and axes reference pages and<br />

“Axes Properties” in [1].<br />

1.7 Adding Axis Labels and Titles<br />

The xlabel( ), ylabel( ), and zlabel( ) commands add x-, y-, and z-axis labels. The title(text)<br />

command adds a text at the top of the figure and the text function inserts text anywhere in<br />

the figure. You can produce mathematical symbols using LaTeX notation in the text string, as<br />

the following example illustrates:<br />

4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!