PCP personal edition
Updated 21/9/2005
PCP personal edition plots polynomial and linear graphs using GNUPlot and calculates errors on best fit lines. The aim is to replicate the behaviour of the PCP terminals in the physics labs but with the following advantages:
- Plotting more than 125 points
- Allows the use of datafiles obtained elsewhere without having to retype them into the terminals (useful for me, as this is no longer possible without admin intervention).
- Integrated CSV file support.
Although the error calculations in linearplot(w) for x-intercept and "Err/sd" do not match the responses from the original version, the error analysis code appears to be working fine.
Downloading and using
Windows users who do not have a compiler should download the Windows version and GNUPlot files, extracting them to the same folder.
Other users should download the source only version. Extract the files using tar -xzvf pcp.tar.gz, and compile the code by running make clean all.
Known bugs/things to do
Here are some of the known problems with the code:
- Printing of datatables and graphs is currently not supported.
Currently polyplot seems to be reliable in terms of results matching known-good answers, and csv2pcp generates valid files.
Usage
pcp linearplot [filename.pcp|filename.csv] linearplotw [filename.pcp|filename.csv] polyplot [filename.pcp|filename.csv] csv2pcp.pl filename.csv > filename.pcp csv2pcp.pl filename.csv filename.pcp cat filename.csv | csv2pcp.pl > filename.pcp
The pcp command takes points in the form "x y", one point per line, with a new line to finish. By default, it saves its output as pcp.txt, but this can be altered by the user.
Changelog
21st September 2005
- Simple CSV support added to all the plotting programs. This is used if the filename ends in ".csv" (in lowercase). In practice, csv2pcp.pl may still be needed for more complex CSV files.
15th September 2005
- A few small changes
- gnuplot_i updated to include callback versions of plotting functions
- C++ list<Point> support added to pointlib.h - currently unused
13th September 2005
- Added filename option to pcp.
- Found hidden heap corruption bug caused by the MakePointlist function, resulting in fopen causing pcp to exit prematurely in "plain" Win32, but not in Cygwin! (The switch to PointlistItem meant that the function allocated too little space for points.)
- Generally reformatted code to make it more maintainable, and added comment headers to all source files.
9th September 2005
- Initial version