altitude = c(0, 1.7087, 3.4091, 5.2045, 10.0239, 19.2010, 30.1161, 43.1627, 53.6129) pressure = c(14.696, 11.022, 7.348, 4.8982, 1.4696, 0.14696, 0.014696, 0.00147, 0.000147) air=data.frame(altitude, pressure) # # plot the data plot(air$altitude, air$pressure, main="Atmospheric Pressure", xlab="Altitude (miles)", ylab="Pressure (psi)") # # take the log(y) but not of the x's air_fit = lm(log(air$pressure) ~ air$altitude) summary(air_fit) # # isolating the factor factor = air_fit$coefficients["air$altitude"] factor # # determining the coefficient coeff = exp(air_fit$coefficients["(Intercept)"]) coeff # #displaying the equation factor = round(factor,4) coeff = round(coeff,3) fit_eq=paste("y=",coeff,"exp(",factor,"x)") text(20,10,fit_eq) # #displaying the curve curve(coeff*exp(factor*x),0,54, add=TRUE, col="blue")