FFT Spectrum or Welch Spectrum
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuesta aceptada
Wayne King
el 17 de Oct. de 2011
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);
Más respuestas (1)
Wayne King
el 17 de Oct. de 2011
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 comentarios
Ver también
Categorías
Más información sobre Spectral Estimation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!