First create a data file with entries as below:
0.00 2.00
1.00 3.1
32.1 5.6
54.33 9.4
.....
A data file can be created by redirecting the program output:
hopf> a.out > tempdata
"tempdata" will contain the data.
An alternative method for redirecting output is:
hopf> script
hopf> a.out
hopf> d
(press control-d)
"typescript" will contain the data.
To plot the data in a file called "tempdata" using gnuplot and then
create an output postscript file:
hopf> gnuplot
gnuplot> plot 'tempdata' t 'legendname' with lines
gnuplot> set output "filename.ps"
gnuplot> set terminal postscript
gnuplot> replot
gnuplot> quit
hopf> lpr filename.ps
To plot a curve directly entered into the gnuplot command line (e.g. a
parabola) and create a jpeg output file:
gnuplot> plot [x=0:1] x**2+3
gnuplot> set terminal jpeg
gnuplot> set output "parabola.jpg"
gnuplot> replot
To use logscales in gnuplot:
Syntax:
set logscale
set nologscale
show logscale
where may be any combinations of `x`, `y`, and `z`, in any
order, and where is the base of the log scaling. If
is not given, then 10 is assumed. If is not given then all
three axes are assumed. The command `set logscale` turns on log
scaling on the specified axes, while `set nologscale` turns off
log scaling.
Examples:
To enable log scaling in both x and z axes:
set logscale xz
To enable scaling log base 2 of the y axis:
set logscale y 2
To disable z axis log scaling:
set nologscale z
For more information regarding "gnuplot" and for instructions for how to get
it for your home computer, click below on "gnuplot info":
gnuplot info
To plot data in a file called "tempdata" using matlab and then print it:
hopf> matlab
>> load tempdata
>> x=tempdata(:,1);
>> y=tempdata(:,2);
>> plot(x,y);
>> print -P
>> quit
note: to plot data from a file called, e.g., "myfile.txt", then replace the
"load tempdata" command with "tempdata=importdata('myfile.txt')"
To plot a given function using matlab use the following "m" file:
matlabplot.m
To plot data in a file called "tempdata.mat" using scilab (windows
machine) and then print it:
1. run scilab
2. change working directory to directory containing "tempdata.mat"
3. loadmatfile('-ascii','tempdata')
4. x=tempdata(:,1);
5. y=tempdata(:,2);
6. plot(x,y);
7. select the print option from the menu on the plot window...
Here is a scilab script file for plotting data within scilab:
scilabscript.sce
Other plotting options:
mathgv
wolfram alpha
example syntax for wolframalpha: "plot sin x from x=0 to 10"
Notes for some apple computers:
Xcode -> preferences -> locations -> derived data (default -> relative)
Xcode -> preferences -> locations -> advanced (unique -> custom)
all files now in .../Build/derived_data/Build/Files/Debug
unix tips:
ls -d */
bash
grep "MAT=1 E=" run.out > error_raw
sed 's/TIME=//; s/MAT=1 E=//gpw err' error_raw > /dev/null