%Generates white nosie and the associates periodogram clear; N=400; t=1:N; x=randn(N,1); for ct=1:N; Nyq(ct)=(-1)^ct; end; figure(1); clf; subplot(211); hold on; plot(t,zeros(N,1),'k--'); plot(t,x,'r'); h=ylabel('white noise'); font(h,16); h=xlabel('time'); font(h,16); font(gca,16); subplot(212); hold on; [s P]=fftPH(x,1,[]); s=[0 s 1/(2*diff(t(1:2)))]; P=2*[(1/N*sum(x))^2 P (1/N*sum(Nyq'.*x))^2]; plot(s,4*ones(N/2+1,1)/N,'k--'); plot(s,P,'r'); h=ylabel('squared Fourier coefficients'); font(h,16); h=xlabel('frequency'); font(h,16); font(gca,16); [4/N mean(P)],