Spectral Analysis of Signals 3-1 Practical Signal Processing Concepts and Algorithms using MATLAB Spectral Analysis of Signals __________________________________________________________________________________________________ ________ QMS Management Consultants Sdn Bhd (401766-U) 98-1-31 Prima Tanjung Jalan Fettes Tanjung Tokong 11200 Pulau Pinang Malaysia Telephone +604 899 6020 Facsimile +604 899 4020 E-mail [email protected]11203 FM 2222 #801 Austin Texas 78730
23
Embed
Practical Signal Processing Concepts and Algorithms using MATLAB
Practical Signal Processing Concepts and Algorithms using MATLAB. Spectral Analysis of Signals. __________________________________________________________________________________________________________ QMS Management Consultants Sdn Bhd (401766-U) - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Spectral Analysis of Signals
3-1
Practical Signal Processing Concepts and Algorithms using MATLAB
Spectral Analysis of Signals_________________________________________________________________________________________________________
_
QMS Management Consultants Sdn Bhd (401766-U)
98-1-31 Prima Tanjung Jalan Fettes Tanjung Tokong 11200 Pulau Pinang Malaysia
• Signal statistics• Discrete Fourier transform• Power spectral density estimation• Time-varying spectra
Spectral Analysis of Signals
3-3
Statistical Signal Processing
System
time
time
time
ens
em
ble
Spectral Analysis of Signals
3-4
Example: Crosscorrelation
x
y
)()( dnxny
>> [c,lags] = xcorr(x,y)>> stem(lags,c)
Spectral Analysis of Signals
3-5
Correlation and CovarianceThe functions xcorr and xcov estimate the cross-correlation and cross-covariance sequences of random processes.
The cross-correlation sequence is a statistical quantity defined as
where xn and yn are stationary random processes, , and E{·} is the
expected value operator which measures the similarity between the two waveforms.The covariance sequence is the mean-removed cross-correlation sequence
,
Spectral Analysis of Signals
3-6
or, in terms of the cross-correlation,
Example on xcorrExample on xcorr
>> y = x; >> x = [1 1 1 1 1]'; >> xyc = xcorr(x,y)
>> stem(xyc)
Example on xcovExample on xcov
>>ww = randn(1000,1); % Generate uniform noise with
%mean = 1/2.
>> [cov_ww,lags] = xcov(ww,10,'coeff');
>> stem(lags,cov_ww)
Spectral Analysis of Signals
3-7
Discrete Fourier Transform (DFT)
Discrete Fourier Transform:
1
011
n
jj
jkk yY
nie /2
Complex nth roots of unity Signal y (top) and transform Y (bottom)
Spectral Analysis of Signals
3-8
Fast Fourier Transform (FFT)
EfficientDFT
Pad /Chop
y Y
Y = fft(y,n)Window length length(y)
FFT length n
fast
Buffer
FFT
Spectral Analysis of Signals
3-9
Fast Fourier Transform (FFT)
• The discrete Fourier transform, or DFT, is the primary tool of digital signal processing.
• The foundation of the Signal Processing Toolbox is the fast Fourier transform (FFT), a method for computing the DFT with reduced execution time.
• Many of the toolbox functions (including z-domain frequency response, spectrum and cepstrum analysis, and some filter design and implementation functions) incorporate the FFT.
Spectral Analysis of Signals
3-10
Cont.
t = (0:0.001:1); %0.001 is sampling
x = sin(2*pi*50*t) + 2*sin(2*pi*120*t);
y = fft(x); %Compute DFT of x
m = abs(y); %magnitude
f = (0:length(y)/2-1)*1000/length(y); %Frequency vector
plot(f,m(1:1:(length(m)-1)/2)) %before filter
grid
[b,a] = butter(9,100/500,'high'); %design filter
c=filter(b,a,x); %implement filter
figure(2)
y = fft(c); %Compute DFT of c(filtered x)
m = abs(y); % Magnitude
f = (0:length(y)/2-1)*1000/length(y); %Frequency vector
plot(f,m(1:1:(length(m)-1)/2)) %after filter
Grid
Spectral Analysis of Signals
3-11
Spectral Analysis with the FFT
y Sampled signal
Fs Samples/unit time
n = length(y) Number of samples
t = (0:n-1)/Fs Principal range
dt = 1/Fs Time increment
Y = fft(y) DFT of sampled signal
abs(Y) Amplitude of DFT
abs(Y).^2/length(Y) Power of DFT
f = (0:n-1)*(Fs/n) Frequency (cycles/unit time)
(n/2)*(Fs/n) = Fs/2 Nyquist frequency
p = 1./f Period (unit time/cycle)
Spectral Analysis of Signals
3-12
FFT Example
>> Fs = 100;>> t = 0:1/Fs:10-1/Fs;>> y = sin(2*pi*15*t) + sin(2*pi*30*t);>> Y = fft(y,512);>> f = (0:length(Y)-1)*(Fs-1)/length(Y);>> Power = Y.*conj(Y)/length(Y);>> plot(f,Power)>> title('Periodogram')