# Ch3 Splus # generate time series with 3 cycles t_1:128 x1_2*cos(2*pi*t*6/128) + 3*sin(2*pi*t*6/128) x2_4*cos(2*pi*t*10/128) + 5*sin(2*pi*t*10/128) x3_3*cos(2*pi*t*40/128) + 4*sin(2*pi*t*40/128) x_x1+x2+x3 min(x) max(x) par(mfrow=c(2,2)) tsplot(x1,main="nu=6/128, amp^2=13", ylim=c(-16,16)) # in above amp^2=2^2+3^3=13 is the square of the amplitude tsplot(x2,main="nu=10/128, amp^2=41", ylim=c(-16,16)) tsplot(x3,main="nu=40/128, amp^2=25", ylim=c(-16,16)) tsplot(x,main="sum", ylim=c(-16,16)) # the periodogram of x par(mfrow=c(1,1)) d_fft(x)/length(x) per_abs(d)^2 freq_(0:64)/128 per_per[1:65] plot(freq,per,type="l") # try it this way spectrum(x, method="pgram", plot=T) # what is that? # ok try this spec.pgram(x, detrend=F, demean=F, plot=T) # Note dB=decibel, and the value S in dBs is 10log_10 S