Sunteți pe pagina 1din 2

Module X : Nonlinear Dynamics Computer Lab

Lab 1: Data assimilation

1 Introduction
Welome to the NLD labs. This is the place where we would have hand on experience on nonlinear phenomena,
although in a digital sense. We would be using several software packages in this class for exploration and insight.
What happens in each class is going to be more or less as follows:
1. A brief pre-lab session (~ 15 - 20 min): In this session you would be introduced to the working concepts
and operating procedures. You can and should takes short notes during this session

2. A hands-on session (~ 45 min): In which you would explore a problem outlined in the trip file for the
class. It is important that you would go through the trip (largely) on your own.
3. A write-up session (~ 20 min): In which you would prepare a short summary report on the problem(s)
visited in the class. This is to be done by filling up an outline provided to help you with the preparation
of the report. Please have a look at the outline before attempting the hands on sessions, as you might be
required to record some interactions during the hands-on session itself. It is very important to complete
the required parts of the sessions in the class itself and get your sessions recorded to your lab copy. To
get the final signature, draw / print the graphs/diagrams, provide answers to the questions specified in
the outline and submit it on the following class.
4. Winding-up : Be prepared with your report at least fifteen minutes before the end of the class and get
them recorded by the instructor during this time.

Try not to miss out a single session since the whole class must move in unison. In case you miss out on one,
complete the trip in your home and submit it in the next class.

2 Trip 1A: Digitizing data points from a graph


Software needed : (1) Plot Digitizer (2) Spreadsheet (3) Gnuplot [video help file: grab.mp4 ]
In many situations we need to read off data points from a published plot so that we may processs them
further and gain more understanding about the underlying phenomenon. In this trip we would be digitizing
data from an image file known as rabbit_population.png using a software called Plot Digitizer. Plot Digitizer is
a free, (LGPL) cross platform program which can extract data points from a graph, calculate distances between
points and find areas of polygons. You would find this software in the course pack. The main steps in digitizing
the data are :
1. Tell the program about where the origin of the graph is located; the program prompts you for this, look
at the status bar.
2. Tell the program about the maximum extents of the x and y axes; again the program would prompt you
for this; do not choose to duplicate the calibration.
3. Click points on the graph. The points clicked would be marked in some way. The program records the
coordinates of the clicked points as you click on them. Click on done, when you are. Save the data points
from the file menu.

Digitize (at least 40) points from rabbit.png. Save these data points to a file called rabbit.csv. Open this file
in a spreadsheet application and copy the data points to rabbit.txt. Read and Plot these data points using
gnuplot using the linespoints style. Compare with the original png file. Are you satisfied with the quality of
digitization?

1
3 Trip 2A: Fitting the digitized points to a polynomial
Software needed : (1) Gnuplot [video help file: fit.mp4 ]
The graph shows a possible relationship between this years and next years population of rabbits on a small
coastal island. Label the axes of the graph as follows:

XLABEL : No. of Rabbits this year


YLABEL : No. of Rabbits next year.
Fit an appropriate polynomial to the data to answer the following questions.

1. In 1999 there are 70 rabbits on the island. How many rabbits are there in 2000?
2. In 2003 there are 35 rabbits on the island. How many rabbits are there in 2004?
3. In 1985 three are 20 rabbits on the island. How many rabbits are there in 1987. Explain your reasoning.
4. In 1992 there are 80 rabbits on the island. How many rabbits were there in 1991?

Why do you think that population of rabbits may be considered to behave in the way depicted in the graph?

4 Write-up
The items in italic are marked for inclusion in the sessions-record

1. Title : Talking with a graph


2. What are the two things you have learnt in the class?
3. What are the commands for fitting a polynomial to a data set? (with example to the context)

4. What were the roles played by the files rabbit.png, rabbit.csv and rabbit.txt ?, e,g
rabbit.png : Contains picture of a plot, serves as input to plot digitizer
5. Expand the filename extensions png, csv.
6. Print the graph generated by Gnuplot along with the fitted function. You would have to generate a png
file from your work according to the instructions given in the next section. What are the contents of
grab.png and fitted.png generated in this step?
7. Answer to Questions 1-4 in the last session
8. Answer to the final question (about the behavior of rabbit population) asked in the last session.

5 How to generate a picture from gnuplot


Open Gnuplot. Type

set term png


set output fname.png

Where fname is the name of the output file. You can use the names grab.png and fitted.png for the assignments.
Now type in the commands which you have used previously to generate the plot. The output of the plot command
will be written to a png file, so you wouldnt see a graph you normally do. When the last command returns,
quit gnuplot. (Only after quitting) you would now find the output png file in your work folder. You can take a
print from this file.