By modifying the original code, make the following 3 programs:
./immig-emig > out1
> is standard output redirection. It creates a file called out1, and all output goes in there.
CAUTION: Make sure there is no existing file with the same
name.
Now plot the outputs with R.
# R > source("/home/progClass/src/immig-emig/immig-emig.r") > plot.ie1("out1") > q() Save workspace image? [y/n/c]: n
Run this program a couple times, and repeat plotting. You now notice that every run results in different outputs.
The output should look like:
23
101
12
4
14
221
:
:
Each line represents the final population size after time 3000 of
each simulation run.
So there should be 10000 lines.
# R > source("/home/progClass/src/immig-emig/immig-emig.r") > hist.ie("out2") > q() Save workspace image? [y/n/c]: n
The output should look like
time AveN 0 10 200 14 400 12 : : : : 3000 15
Plot outputs with R (you can probably use the same R funcion as Modification A).