%% Multitaper Estimate with Sample Rate
% Obtain the multitaper PSD estimate of a signal sampled at 1 kHz. The signal is a 100 Hz sine wave in additive N(0,1) white noise. The signal duration is 2 s. Use a time-halfbandwidth product of 3 and DFT length equal to the signal length.

fs = 1000;
t = 0:1/fs:2-1/fs;
x = cos(2*pi*100*t)+randn(size(t));
[pxx,f] = pmtm(x,3,length(x),fs);

%
% Plot the multitaper PSD estimate.

pmtm(x,3,length(x),fs)

% Copyright 2015 The MathWorks, Inc.