Assignment #6 - Using a
Scientific Plotting Package - PSI-Plot
Set March 18 - due April 1
The purpose of this exercise is to show you how easy it is to
create graphs with a modern plotting package; also to show you
some of the power of doing mathematics using some of the many
built-in functions and options that are available. Such packages
are usually better than spreadsheets for doing detailed plots.
Note that PSI-Plot is a relatively lightweight program; there are
many much more sophisticated packages available (e.g. Sigma Plot, Origin ..).
[LC] = left click, [RC] = right click
1. XY Plot with Error Bars.
You will import a file and plot it. The file contains measured values of
absolute gravity (with errors) and relative gravity (both in units of microgal)
at specified times (in days) over roughly a two year period at a geodetic
observatory.
- Start PSI-Plot; a basic opening screen appears
- Select File/New/Sheet; a more elaborate screen appears in
spreadsheet format
- Select File/Import Data/; change to your home directory
and select ex3t.txt;
select Open and New Sheet
- The table will import immediately; change column titles
to Time (in days), Absg, Error, and Relg and save the table as the
sheet file ex6a.pdw
- Select Plot/2D Curve/Error Bar; the 2D XY-Line Plot
dialog box will open; make sure Time is the x axis, Absg
the y axis and the errors are taken from the column
'Error'; click OK to open the plot in its own window and
then save it as ex6a.pgw
- [RC] on the line plot (between symbols) and a Normal
Curve Format dialog box appears; select the following
options: Style - filled diamond, Symbol size - 75, Line
size - 10, Line Connected, Line Type - dashed, Pattern -
choose some fill pattern; also choose colors for the
symbol and fill, choose OK
- [RC] on graph background (inside the graph area) to bring
up the Frame Format dialog box; select a two-color
background fill style that you think is appropriate to the plot [Hint:
use light colors], click OK
- Make sure axes are properly labelled (with units), add a
title and print ONE FINAL COPY to LJ3 (the color printer
in Room 331); close the plot file and save as ex6a.pgw (do
not close PSI-Plot yet).
2. Using Mathematical Features of PSI-PLOT
Save the file ex6b.dat in your home
directory; it contains a plot of relative gravity (in microgal) versus time (in
day).
You will fit mathematical functions to this data.
- Start a new PSI-Plot sheet and import ex6b.dat;
save as ex6b.pdw
- Change the column headings to
Time and Relg
- Select Math/Fitting/Line; the Straight Line dialog box
opens; select Calculated Data, Best Fit Parameters, [LC]
OK.
- The Line Fitting Report Opens; make a note of the most
important parameters of the fit.
- Q1: What are the most important parameters of
the fit?
Q2: What is the equation of the best fit
straight line?
- [LC] OK and the Report windows closes and the sheet is
updated
- You should now identify the new columns created on the
sheet (Ind3, Dep4)
Q3: What are they?
- Now delete the column representing the independent
parameters and change the number notation of the two
remaining columns to match that of the input data.
3. User defined fit
Now you will do a non-linear fit using a user-defined
exponential; as you go along, note the differences from the linear fit.
- Select Math/Fitting/User Define; the User Defined Fitting
dialog box appears. Now you will edit in this window, but
make sure YOU DO NOT OVERWRITE OR ALTER THE TEXT IN
BRACKETS e.g. (INDVAR). You should edit the various
options to fit the following formula:
Relg = A*EXP (-B*Time)+C
Q4:
Write down the equation for this formula.
- Note that the parameters to be fitted are A, B and C and
the independent and dependent variable names must match
those in the sheet. Try as starting values A=-30, B=0.001
and C=20. When you are ready, click on Compile to make
sure your formula is valid and click OK when successful
- Now click Solve to start the iterations. These could take
some time, so be patient (!) and watch the number of
iterations and the Sum of Squares change in the Fitting
Progress dialog box. When the fitting has converged
Q5: How many iterations? what
is the final sum of squares?
- Make sure you click on Best Fit Parameters before viewing
the Fitting Report. You should save the report in a file
before you close it
Q6: Is the fit obtained using
an exponential better than a straight line? How do you
know this?
- The data sheet should now show 3 more columns; repeat the
steps in above to get rid of the unwanted column
- Finally plot the original data (Relg) and the two fitted
functions (i.e. the straight line and the exponential)
using the Plot/2D Curve/XY Lines options
- Choose suitable columns to plot
Q7: What
are the suitable columns to plot?
- After you have chosen each selection, [LC] on Add
Curve and then go on to the next data. As you proceed,
make sure the symbol sizes are set to zero and the line
size is small, otherwise big symbols will be plotted for
all the large number of points! When finished, choose
OK to view the plot
- When your first attempt appears, you can right click on
the line to bring up the Normal Curve Format dialog box
to choose line types and colors to distinguish the 3
lines
- Select the plot ([LC]) and choose Option/Add Legend to
add a legend; use options Clean BKGrid and With Frame.
Move the legend to where you want it (e.g. the bottom
right hand corner). The you can edit the elements of the
legend (i.e. the text and the line types to match those
in the plot) after using Option/Ungroup. Note that once
the elements are ungrouped for editing, the legend as a
whole cannot be moved without re-grouping!
- When you are happy with the result, save the plot as ex6b.pgw print ONE FINAL
COPY to the color printer.
Read the discussion of your first document (Assignment #2)
particularly with respect to Figure 7.
Q8: Discuss the significance of the
fitted lines
Submit your answers to the 8 questions and attach your color
graphs ex6a.pgw and ex6b.pgw.
End of Assignment 6.