# Exercise 1.3
# Math Warm up. Mangel 2006
# Borrett | Aug 2010
# ------------------

# ----- INPUT ---------- 
# define paramters
t = 0:100   # time
a = 1       # shape parameter
b = 100       # shape parameter

# ----- ACTION ----------
# solve equations
g1 = a*t/(b+t)
g2 = a*t^2/(b + t^2)

# ----- OUTPUT ----------
# PLOT

par(las=1)  # change plotting paramters

# create plot
plot(t,g1, pch=20, col = "blue",
     ylim=c(0,a),
     type = "b",
     cex = 1.5,
     ylab = "functional response",
     xlab = "time",
     main = "Exercise 1.3")

# add second line to the existing plot
points(t,g2,
       pch=19,
       col="green",type="b",cex=1.05)

# create the figure legend
legend(60,0.8, legend=c("g1","g2"),
       col=c("blue","green"),
       pch=c(20,19),bty="n",cex=2)



