# # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- N=200 fs = seq(0,1/2,length.out=N) gf = 2 / ( 9/4 -3 * cos( 2 * pi * fs ) + cos( 4 * pi * fs ) ) #postscript("../../WriteUp/Graphics/Chapter3/prob_7_plot.eps", onefile=FALSE, horizontal=FALSE) plot( fs, gf, pch=c("o"), col=c("black"), xlab="frequency", ylab="g(f)" ) #dev.off() # find the location of the maximum and the frequency there # mv = max(gf) mi = which.max(gf) mf = fs[mi] # then dominant period is given by # 1/mf # Integrate to get the part of the total variance in this frequency range # myFn <- function(fs) {2 / ( 9/4 -3 * cos( 2 * pi * fs ) + cos( 4 * pi * fs ) )} int = stats::integrate(myFn,0,0.2) sigma_z2 = 12/5