HOMEWORK #6
DUE NOVEMBER 18
(3 POINTS)
-
Write a subroutine that will perform a linear regression(linear
least square analysis) of the input data set. Copy the data set file datahw61.dat
form /home/h4/fort1/fortran/hw. Plot the data and the best fit line
on one set of axis for comparison. Help for plotting is available
here.
-
The second data set, datahw62.dat, has an additive exponential trend
trace(j) = data(j) + a*exp(b*j). write a subroutine which will transform
this data set (take the natural logarithm of the data), then call
your linear least square analysis subroutine to determine the parameters
of the exponential trend. Plot the original data and exponential function
you determine.Detrend the data trace.
-
The data also has a mean value. Demean the data. Plot the trace after you
have detrended and demeaned the data.
Turn in:
-
Your least square subrouine, and the plot of the data of problem 1 with
the best fit line plotted.
-
Your subroutine to transform the data values, a plot of the original daya
and exponential trend function. turn in the best fit values of the amplitude
"a" and the exponent term "b" which describe the trend.
-
Turn in the value of mean of the data and a plot of demeaned, detrended
data trace.
Supplement:
The formulas for calculating the least suares best fit of some data
are:
where
yi = a + b*xi