FFT Spectrum or Welch Spectrum

6 次查看(过去 30 天)
Hello everybody, I wrote a windowing function with an average of FFt's and calculated the same with the Matlab function pwelch. The welch algorithm and the FFT spectra resulting in a marked different spectral plot. I could narrow down the problem: The single spectra calculated with the fft are the same for both versions, but then the welch algorithm (Line 132: [Pxx,w,units] = computepsd(Sxx,w,options.range,options.nfft,options.Fs,esttype);) calculates the power densitiy, which results in a different spectral appearance. Along with this spectral shift, I get also a small shift in the highest frequency peak (from 30.0 Hz to 29.5 Hz; both calucated with a resolution of 0.1 Hz). Any common eplanation for that? Due to the fact, that I'm looking for the main period of oscillation in my data, I'm puzzled which on will be the right one? I'm gratefull for any hlep. Thanks a lot!

采纳的回答

Wayne King
Wayne King 2011-10-17
Hi, Are you attempting to say that you wrote your own Welch overlapped segment averaging routine? The WOSA estimator is an estimate of the power spectral density.
The Welch estimate does result in a broadening of the peaks, which may explain the slight frequency shift you see. If you are attempting to identify a particular frequency then the periodogram has the best frequency resolution of any nonparametric estimator.
For example:
Fs = 1e3;
t = 0:1/Fs:1-1/Fs;
x = cos(2*pi*100*t)+randn(size(t));
psdPer = psd(spectrum.periodogram,x,'Fs',Fs,'NFFT',length(x));
% Welch estimate
hwelch = spectrum.welch;
% 5-Hz DFT bin spacing
hwelch.SegmentLength = 200;
psdWOSA = psd(hwelch,x,'Fs',Fs,'NFFT',hwelch.SegmentLength);
plot(psdPer);
figure;
plot(psdWOSA);
  1 个评论
Peter
Peter 2011-10-17
Thanks for the code.
Indeed, I wrote a Welch like overlapped segment analyze to calcuate a fft with a fixed frequency resolution for varying length of input data. One thing I didn't like on the original Welch script is that the overlapping data point are discarded - I put them in the last vector with the compromise that this one does not overlapp the one before exactly for 50%. I also do not like the nex power of 2-fft implemented in periodogram as far as I understood.
Is the fft the best compromize between frequency and power resolution?

请先登录,再进行评论。

更多回答(1 个)

Wayne King
Wayne King 2011-10-17
The periodogram does not have to use next power of 2. Look at my example, I specified the length to be the length of the input vector. You can specify NFFT as an input argument.
Also, the Welch estimate does not discard the overlapping data points. You may lose some data at the end, but you can control that by adjusting the segment length and overlap.
For example, in my example I had an input of length 1000.
By specifying a window length of 200 and using the default noverlap of 50. The overlapped spectra were computed for
  1. 1:200
  2. 151:350
  3. 451:650
  4. 601:800
  5. 751:950
I could have easily adjusted the window length and overlap to utilize every single data point (but I don't think that buys you anything here)

类别

Help CenterFile Exchange 中查找有关 Spectral Estimation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by