#example
t<-1:5000
y<-1.1*sin(2*pi*0.3*t)+7*sin(2*pi*0.4*t)+10*rnorm(length(t))
m=1000
z <- kzft(y, m, 1, dim=2)
a<-log(kzp(z$Complex,m,1))
spg.dz<-smooth(a,0.03, method="DZ")
spg.nz<-smooth(a,0.03, method="NZ")
omega<-seq(0,1,length=1000)[1:500]
par(mfrow=c(2,2))
plot(omega,a,main="Raw periodogram",type="l", xlab="Frequency", ylab="")
plot(omega,spg.dz,main="Smoothed Periodogram DZ method",type="l", xlab="Frequency", ylab="")
plot(omega,spg.nz,main="Smoothed Periodogram NZ method",type="l", xlab="Frequency", ylab="")
Run the code above in your browser using DataLab