A sample call would be
scatterf("y1(x)","x",1,2,¯3,4,1000)
which plots 1000 points of the function y4(x) from x=1 to x=2, with a y-axis range of -3 to 4.
scatterf() plots each point as it is calculated, so you can see the plot develop. You may stop scatterf()
by pressing any key. Press [HOME] to return to the home screen display.
scatterf() clears the graph screen and turns off all function and data plots. Also, the program I/O screen
is cleared. Note that you must specify the y-axis limits. If you set the limits too low, so that not all the
points can be plotted, scatterf() displays the error message range error in the upper left screen corner,
but it continues plotting. scatterf() also displays the y-value of that caused the range error on the
program I/O screen. If range errors occurred, the program I/O screen is automatically displayed when
scatterf() is finished, or if you press a key to stop scatterf().
There is little point to using scatterf() for most functions. scatterf() is most useful when the function
changes very rapidly at each x-axis pixel coordinate. For best results, thousands of points are typically
be plotted.
[4.13] Bode plots
A Bode plot graphs the magnitude and phase angle of a complex function of frequency. Both the
frequency and magnitude are plotted on logarithmic axes, but the phase angle uses a linear axis. Bode
plots are commonly used in electrical engineering applications to show the performance of filters or
other transfer functions. The 89/92+ do not have built-in logarithmic scaling for function plot axes, but
you can easily accomplish this effect with a data plot. In general, the steps are:
1. Define the transfer function G(s), where s is the frequency-domain variable.
2. Create a frequency list with logarithmic spacing. You can use the function loglist() in tip 3.22 to
do this, or you can do it manually.
3. Create a list of the magnitudes of the transfer function at each frequency, by applying the
built-in abs() function to G(s) evaluated at each frequency.
4. Create a list of the phase angles of the transfer function at each frequency, by applying the
built-in angle() function to G(s) evaluated at each frequency.
5. Create a list of sequential integers, with as many elements as the frequency list in 2. This list
will be the x variable in the data plot. This list is easily made with the built-in seq() function.
6. For the magnitude plot, define a data plot with the lists in 5 and 3.
7. For the phase plot, define a data plot with the lists in 6 and 3.
8. Display the plots with the ZoomData menu item in the Zoom menu.
Other users have written Bode plot programs that are more sophisticated than this method, and result
in better-looking plots, but this method is effective if you only need the occasional plot.
As an example, suppose that we want to plot the transfer function, from 10 to 1000 Hz, of a filter
defined by
4 - 18