<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//en">

<!–Converted with LaTeX2HTML 2022 (Released January 1, 2022) –> <HTML lang="en"> <HEAD> <TITLE>Contents of 2-D Plotting</TITLE>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0"> <META NAME="Generator" CONTENT="LaTeX2HTML v2022">

<LINK REL="STYLESHEET" HREF="rlabp_tex.css">

<LINK REL="next" HREF="node49_mn.html"> <LINK REL="previous" HREF="node47_mn.html"> <LINK REL="up" HREF="node47_mn.html"> <LINK REL="next" HREF="node49_mn.html"> </HEAD>

<BODY bgcolor="#ffffff" text="#000000" link="#9944EE" vlink="#0000ff" alink="#00ff00">

<H2><A ID="SECTION000121000000000000000"> 2-D Plotting</A> </H2>

<P> To plot some data with a minimum of effort do:

<P> <PRE> &gt; data = (0:pi:.1)'; &gt; data[;2] = cos (2*pi*data*3); &gt; pstart („"xwin"); &gt; plot (data); </PRE>

<P> The <code>pstart</code> function was called with the default sub-plot definition (1 subplot), and the X-windows driver as the display device. The <code>plot</code> function accepts matrices, or lists as arguments and plots the columns of a matrix, or the columns of each matrix of a list.

<P> Now for a slightly more complex example.

<P> <PRE> &gt; t = (0:10:.05)'; &gt; x = exp (-0.5*t) .* (cos (2*pi*3*t) + sin (2*pi*7*t)); &gt; X = fft (x); &gt; rfile faxis &gt; freq = faxis (X, .05, 3); &gt; mag = abs (X); &gt; rfile angle &gt; phase = angle (X); &gt; pstart (1,2,"xwin"); &gt; &gt; ptitle ("Magnitude of FFT") &gt; xlabel ("Frequency (Hertz)"); &gt; plot ([freq,mag]); &gt; &gt; ptitle ("Angle (atan2(imag/real)) of FFT") &gt; xlabel ("Frequency (Hertz)"); &gt; ylabel ("Angle (radians)"); &gt; plot ([freq,phase]); &gt; plprint ("p3.ps"); </PRE>

<P> <P>

<DIV class="CENTER"><A ID="p1"></A><A ID="507"></A> <TABLE> <CAPTION class="BOTTOM"><STRONG>Figure:</STRONG> Example Plot</CAPTION> <TR><TD><IMG STYLE="height: 286.76ex; " SRC="img7.png" ALT="

\begin{figure}\begin{picture}(350,350)(0,50) % (x-size, y-size) (x-shift, y-shif...
......angle=90 hscale=60 vscale=60 voffset=40 hoffset=460
\end{picture}\end{figure}
"></TD></TR> </TABLE> </DIV>

<P> In this example we create a plot-window with two subplots so that we can display related information on the same plot-window. The arguments to <code>pstart</code> specify that there will be 1 plot in the horizontal direction, and 2 plots in the vertical direction, thus creating 2 sub-plots. The first <code>ptitle</code> and <code>xlabel</code> function calls effect the first sub-plot. The first call to <code>plot</code> creates the first sub-plot. The subsequent calls to <code>ptitle</code>, <code>xlabel</code> and <code>ylabel</code> effect the second sub-plot, and the last call to <code>plot</code> creates the second sub-plot.

<P> The last line is a call to <code>plprint</code>. The <code>plprint</code> function creates a file that contains a copy of the contents of the current plot-window. The default hardcopy device for <code>plprint</code> is Postscript, but color Postscipt, Xfig, plmeta, and HP-LJII can also be specified. The output from <code>plprint</code> is presented in Figure&nbsp;<A HREF="node48_ct.html#p1"><IMG ALT="[*]" SRC="crossref.png"></A>.

<P>

<HR>

</BODY> </HTML>