FFT Spectrum or Welch Spectrum
조회 수: 3 (최근 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!
댓글 수: 0
채택된 답변
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개)
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:200
- 151:350
- 451:650
- 601:800
- 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)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Estimation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!