DOC PREVIEW
CSBSJU PHYS 370 - PHYSICS 370- PLOT

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Appendix B: plotplot is a general purpose, advanced plotting program. plot can be frustrating to usebecause it assumes you know what you want to do and actually mean w hat you say—so ifyou don’t know what you’re doing and don’t know what you say means to the machine, youcan draw a mess fast. Of course, after you know the program you should be able to drawa beautiful graph as fast as you drew that mess.The m ost unusual feature of plot is the way you give values to the parameters needed todraw a graph, e.g., th e size of the graph, maximum and minimum values, etc. Instead ofasking you if you want to change each of those 39 parameters, plot allows you to set themin any order, at any time you want. For example, if you want to change the minimum valueof x to 0, you type* SET XMIN=0(Don’t forget to hit the R eturn or Enter key after each line. Note: you cannot edit theselines using arrow keys: you must backspace!)So the first thing you need to know is the name of the parameters. You will find a completelist at the end of this appendix but let me mention three important sets of parameters now.The first set determines the way the axes look: XMIN, XMAX, XSCALE and s imilarly for y.XMIN and XMAX should be self explanatory. XSCALE determines the nature of the scale:XSCALE=1 is a linear (normal) scale;XSCALE=2 is a logarithmic scale (distance in plot is p roportional to log x);XSCALE=3 is an inverse scale (distance in plot is proportional to1x); andXSCALE=4 is a probability scale (distance in plot is related to erf−1(x)).(Note: you will rarely actually set XMIN and XMAX as there are autoscale commands, butyou will often be setting the type of scale.)The second set determines how the p rogram finds the proper data to plot. Basically to getnumbers (x, y, and errors) into the program you need to make a file with the editor. Thefirst line of this file should be a one-line description of the data in the file (i.e., free fallexperiment - trial #2). The following lines should consist of data—an x value, somespaces (or tabs or commas), the corresponding y value, some spaces, and the correspondingabsolute error in y. Thus when looked at as a whole, the first column will consist of xvalues, the second column th e corresponding y values, etc. If you called this file plot.dat173174 Appendix B: plotyou have made a file exactly in the default manner. The program will be able to READ thisfile without telling it anything. If you put the x values in column 2, you will have to informthe program by typing* SET XCOL=2That is, XCOL is a variable that tells the program which column contains the x values.Similarly, YCOL, YECOL (y-error) and XECOL (x-error) are variable names. If you h ave noerrors, tell the program by typing* SET YECOL=0If you didn’t call your file plot.dat, you must tell the program by typing* SET FILE=filenameNote the above SETing does not actually change the data inside the program. The datainside the program is only changed when you:* READFinally the third set determines how functions are plotted.* SET F(X)=SIN(PI*X)* SET PMIN=-1 PMAX=1* FCURVEFCURVE will plot the function in the domain PMIN to PMAX (the “p” is f or parameter—remember xmin and xmax have another meaning). Note that th e bord er parameters (ymin,ymax, etc.) must be approp riately1set before the function curve is added to the plot. F(X)can be set using the usual computer syntax2for algebra. There are eleven built-in functionsthat correspond to the u s ual WAPP+functions with the usual parameters A, B, and C.These can be plotted by SETting the function number NFUNCT to a value between 1 and 11.NFUNCT=0 (the default) plots the function F(X).You use SET to tell the program on how you want your data displayed. To actually d isplaydata you need action commands. The sequence:* READ* SCALE* BORDER* DPOINT1FSCALE will find appropriate ymin, ymax, etc., based on the functionf(x) and d omain PMIN to PMAX, butmore commonly the border parameters — including PMIN and PMAX — are set to fit the data with SCALE2Note that you must use * for multiplication not just juxtaposition.Appendix B: plot 175tells the program to read the data (from the previously set FILE); SCALE tells the programto find appropriate XMIN, etc. given the data contained in the program; BORDER tells theprogram to display the graph outline you have described; DPOINT tells the program to plotthe data points. Type FCURVE to plot your function. Another useful command is HELP—ittypes out a listing of the commands and the variables.Actually all this SETting and commanding can be done together as shown below: (note onecommand per line, but you may define several variables)* READ YECOL=0, FILE=freefall1.dat* SCALE* BORDER TITLE=’Free Fall’, XLABEL=’Time (s)’, YLABEL=’Z (m)’* DPOINT* FCURVE PMIN=0, PMAX=.65, NFUNCT=10, A=0, B=0, C=4.9Two final comments: The equal signs and commas in the above example make the readingof the line easier—but they make the typing of the line harder. You may substitute spacesfor them to make typing easier. Similarly, one gets tired of typing in the full command incapitals—lowercase and any unambiguous abbreviations may also be used. Thus instead ofthe above you may type:* re yec 0 fi freefall1.dat* sc* bo tit ’FREE FALL’ xl ’TIME (s)’ yl ’Z (m)’* dp* fc pmin 0 pmax .65 nfu 10 a 0 b 0 c 4.9Getting Hardcopy PlotsNow that you have a plot displayed on the terminal, you should want a copy of the screento put in your lab notebook. T he command PCOPY will make a copy of the displayed plot tothe file specified by PFILE. If PFILE=" " (as it is by default), the output goes to the printer.Special CommandsStart—in a terminal type: plot$linux command — do any linux command from inside plot@filename — execute indirectly a file of plot commandsCtrl D — to exit programExamples:* $ls *.dat* @fet.pltReport problems/suggestions to Tom Kirkman.176 Appendix B: plotplot Commands(unambiguous abbreviations and lowercase allowed)Syntax:* COMMAND* COMMAND VARIABLENAME = value, VARIABLENAME = value ...Examples:* BORDER XMIN=0, XMAX=1, YMIN=-1, YMAX=1, TITLE=’now is the time’* bo xmi 0 xma 1 ymi -1 yma 1 ti ’now is "the time"’BORDER draws a border for a graphCLEAR clears the screenCROSSH digitizing mod e—using the mouse move the ‘crosshair’ to the desired point. Holdthe Shift key and click; the x and y value at crosshair is reported.DCURVE connects with a LINE NPOINT data points, starting with


View Full Document

CSBSJU PHYS 370 - PHYSICS 370- PLOT

Download PHYSICS 370- PLOT
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view PHYSICS 370- PLOT and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view PHYSICS 370- PLOT 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?