4.1 Reading data into physica

When you have quit physica it ``forgot'' what vectors x, y, dy were, and if you want to look at them again for some reason, you need to re-type them. A more convenient approach would have been to enter your data into a file using your favourite editor first, and then to read that file into physica at will. In fact, you may already have created this file from the previous tutorial session, when you practiced using vi or pico. Otherwise, create this file (call it file.dat) now, using your favourite editor outside of physica. You may want to open a separate shell window for this purpose, putting your physica session aside for a moment. Enter the following data into this data file:

1.0  0.05  0.02
2.0  0.10  0.07
3.0  0.14  0.01
4.0  0.19  0.04
5.0  0.25  0.05
6.0  0.30  0.10
7.0  0.34  0.02
8.0  0.40  0.04
i.e. the same data as we used before, now entered as three columns.

Start physica again, or move your mouse to the physica window, and use a single read command to create all three vectors of our simple example:

PHYSICA: read file.dat x,y,dy
PHYSICA: list x,y,dy

Use the list command to verify that the data has been read in correctly. The rest of the commands required to generate the plot of Figure 1 remains exactly the same. Test yourself: try to generate this plot again.

Up: 4. A simple example Next: 4.2 Programming with physica macros Previous: 4. A simple example