Presentation is loading. Please wait.

Presentation is loading. Please wait.

Department of Kinesiology and Applied Physiology Spectrum Estimation W. Rose 2013-04-06.

Similar presentations


Presentation on theme: "Department of Kinesiology and Applied Physiology Spectrum Estimation W. Rose 2013-04-06."— Presentation transcript:

1 Department of Kinesiology and Applied Physiology Spectrum Estimation W. Rose

2 Department of Kinesiology and Applied Physiology Signal x(t) t=0 to T ΔT=sampling interval=1/f samp N=number of samples T=N ΔT “Simple” spectrum estimate S(f) = power spectrum = k||X(f)|| 2 X(f)=discrete Fourier transform of x(t) (X(f) is complex) wheref = 0 to Δf·N/2 = 0 to f samp /2 (“single-sided”) f = 0 to Δf·(N-1) (“two-sided”) and where Δf=1/T

3 Department of Kinesiology and Applied Physiology Spectrum Details S(f) = power spectrum = k||X(f)|| 2 whereX(f) = discrete Fourier transform of x(t) X(f) is complex; S(f) is real If x(t) has N points Then two-sided spectrum has N points one-sided spectrum has N/2+1 points k=normalizing factor; depends on particular routine used to calculate spectrum: single or double sided, “peak” or “RMS” units, etc. (1)

4 Department of Kinesiology and Applied Physiology *d k =4/(kπ)=amplitudes for ±1V square wave (k odd).

5 Department of Kinesiology and Applied Physiology Example of the “simple” spectrum estimate Matlab code to make t and x(t) and plot: dt=0.01 t=(0:499)*dt; f=1; d1=4/pi; d3=4/(3*pi); d5=4/(5*pi); x=d1*sin(2*pi*f*t)… +d3*sin(2*pi*3*f*t)… +d5*sin(2*pi*5*f*t); plot(t,x,’.r-’);

6 Department of Kinesiology and Applied Physiology Example of the “simple” spectrum estimate Matlab code to compute amplitude spectrum using fft(x): X=fft(x); Xamp_2s=abs(X); N=length(x); T=N*dt; df=1/T; freqs=(0:N-1)*df; plot(freqs,Xamp_2s,’.r-’); Note: fft(x) returns a 2-sided spectrum, as is evident from the graph below. Amplitude spectrum (two-sided)

7 Department of Kinesiology and Applied Physiology Example of the “simple” spectrum estimate The non-zero values |X(f)| = d k ·N/2, where d k =the amplitude of the sinusoid used to contruct x(t), as shown on an earlier slide. This shows that values returned by fft(x) scale like N/2, except at f=0 and f=f Nyquist =f samp /2, at which frequencies the values returned by fft(x) scale like N (not shown in this example). The “divide by two” scale factor is due to the fact that the energy that started out at 1 Hz is split between 1 Hz and 99 Hz in the two-sided spectrum. Amplitude spectrum (two-sided)

8 Department of Kinesiology and Applied Physiology Example of the “simple” spectrum estimate Compute the single-sided power spectrum. Divide by N at f=0 and f=f Nyquist ; divide by N/2 at all other frequencies. S=([Xamp_2s(1) Xamp_2s(2:N/2)*2 Xamp_2s(N/2+1)]/N).^2; freq1s=(0:N/2)*df; plot(freq1s,S,'.r-'); xlabel('Frequency (Hz)'); ylabel('Power'); This gives S(f)=d 1 2,d 3 2,d 5 2 at the appropriate frequencies. Single-sided power spectrum

9 Department of Kinesiology and Applied Physiology A Better Spectrum Estimate Overview 1. Divide the time domain record into blocks. 2. Find power spectrum of each block. 3. Average the power spectra, frequency by frequency.

10 Department of Kinesiology and Applied Physiology A Better Spectrum Estimate: Details 1.Divide time domain record into segments of equal length. If there are q non-overlapping segments, then also include q-1 half-overlapped segments. Example: Total data record length=N tot =4000 points. Investigator chooses q=4. Then each segment has length N seg =N tot /q=1000 points. The four non- overlapping blocks start at points 0, 1000, 2000, Three half-overlapped blocks start at 500, 1500, Total number of segments=2q-1=7.

11 Department of Kinesiology and Applied Physiology A Better Spectrum Estimate: Details 2. Find power spectrum of each segment. Before computing spectrum of each segment, remove linear trend, resulting in block with zero mean value and zero slope. Some prefer to remove only the mean value and not the linear trend (if any). Window the data in the segment with Hann or Hamming window. Compute power spectrum of windowed data. Correct power spectrum for the loss of power caused by the window: Hann window: multiply power estimates by 8/3. Hamming: multiply power estimates by

12 Department of Kinesiology and Applied Physiology A Better Spectrum Estimate: Details 3.Average the power spectra, frequency by frequency. S avg (f)=(1/(2q-1))*Sum(i=1 to 2q-1){S i (f)} where S i (f)=power at frequency f of the i th segment

13 Department of Kinesiology and Applied Physiology

14 Scale Factors for Power Spectrum Estimates “single-sided” spectrum: At each non-zero frequency (from Δf to highest frequency below the “halfway point”, which is f=f samp /2), multiply the two-sided estimate at that frequency by 2 to get the single-sided power estimate. The single sided spectrum only goes to f samp /2. At f=0 and at f=f samp /2, the single sided estimate is the same as the two-sided estimate. See Labview help for Power Spectrum.vi (returns two-sided spectrum) and Auto Power Spectrum.vi. (returns one-sided spectrum).

15 Department of Kinesiology and Applied Physiology

16 Partial front panel of FFT_and_Power_Spectrum_Units.vi Example VI in LV2012 Output from FFT.vi scales like record length n. Other VIs return output whichh is independent of record length. FFT and Power_Spectrum return two-sided spectra, which is why their non DC scaling is divided by 2. The other VIs return one-sided spectra. FFT_Power_Spectral_Density divides each power spectrum estimate by Δf, the frequency spacing between estimates (Δf =spectral width of each estimate).


Download ppt "Department of Kinesiology and Applied Physiology Spectrum Estimation W. Rose 2013-04-06."

Similar presentations


Ads by Google