www.gusucode.com > signal 案例源码程序 matlab代码 > signal/PeriodogramUsingDefaultInputsExample.m
%% Periodogram Using Default Inputs % Obtain the periodogram of an input signal consisting of a discrete-time % sinusoid with an angular frequency of $\pi/4$ rad/sample with additive % $N(0,1)$ white noise. % Copyright 2015 The MathWorks, Inc. %% % Create a sine wave with an angular frequency of $\pi/4$ rad/sample with % additive $N(0,1)$ white noise. The signal is 320 samples in length. % Obtain the periodogram using the default rectangular window and DFT % length. The DFT length is the next power of two greater than the signal % length, or 512 points. Because the signal is real-valued and has even % length, the periodogram is one-sided and there are 512/2+1 points. n = 0:319; x = cos(pi/4*n)+randn(size(n)); [pxx,w] = periodogram(x); plot(w,10*log10(pxx)) %% % Repeat the plot using |periodogram| with no outputs. periodogram(x)