MATLAB Answers

Setting pwelch frequency resolution

45 ビュー (過去 30 日間)
Hi All, I have a time series recorded at 100Hz for which I want to use pwelch (60 sec signal). My prob is that I want to obtain the results with a specific resolution of 0.01Hz and I am struggling to set up the right inputs for the windows, nfft and overlap to achieve that. Any ideas how to do that?

  0 件のコメント



Nitin Kapgate
Nitin Kapgate 2020 年 8 月 13 日
Refer to the documentation of “pwelch” function for the calculation of different parameters to be used to achieve the desired frequency resolution. If you want to learn more about how the “pwelch” function is used in a practical application, refer this example here.
The following code snippet will help you in using the “pwelch” function in your application.
% Reset the random number generator for reproducible results.
rng default
fs = 100; % Assuming the sampling frequency is 100 Hz
t = 0:1/fs:60-1/fs; % Assuming that the signal is of 60 Seconds length
x = cos(2*pi*0.01*t) + randn(size(t)); % Create a test signal in which some randomized AWGN noise
% is added to a sinusoidal signal of 0.01 Hz frequency
% Use Welch's power spectral density estimation function to estimate the PSD.
% Calculation of the input parameters for "pwelch" function to get the required frequency resolution
% Resolution Required = 0.01 Hz
resolutonReqd = 0.01;
% Calculate number of FFT points (NFFT) required for the required resolution
% fs/NFFT = resolutionReqd
NFFT = fs / resolutonReqd;
% Set window size for averaging to 200
window = 200; % This makes number of FFT averages to 6000 samples/ 200 = 30
% Set overlap to 0
overlap = 0;
% Now use pwelch with above parameters.
[pxx,f] = pwelch(x,window,overlap,NFFT,fs);
% Now plot the PSD
xlabel('Frequency (Hz)')
ylabel('PSD (dB/Hz)')

  1 件のコメント

Luis Eduardo Cofré Lizama
Luis Eduardo Cofré Lizama 2020 年 8 月 13 日
Thanks a lot for the referal and solution. I was failing using the NFFT input and overlap. Reg the latter, in which way this affect the outcome?
Cheers Nitin!


その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by