WAVELETS AND MULTIRATE DIGITAL SIGNAL...

6

Click here to load reader

Transcript of WAVELETS AND MULTIRATE DIGITAL SIGNAL...

Page 1: WAVELETS AND MULTIRATE DIGITAL SIGNAL …nptel.ac.in/courses/117101001/downloads/Lec-22_Tutorial.pdf · WAVELETS AND MULTIRATE DIGITAL SIGNAL PROCESSING Lecture 22: Reconstruction

WAVELETS AND MULTIRATE DIGITAL SIGNAL PROCESSING

Lecture 22: Reconstruction and AdmissibilityProf.V.M.Gadre, EE, IIT Bombay

Tutorials

Q 1. Construct the STFT, CWT of the signal x(t) using ’Matlab’ and discuss the observations.

x(t) =

cos(2π10t)when 0 ≤ t ≤ 5cos(2π25t)when 5 ≤ t ≤ 10cos(2π50t)when 10 ≤ t ≤ 15cos(2π100t)when 15 ≤ t ≤ 20

Ans. The STFT is one of the most straightforward approaches for performing time-frequencyanalysis and can help you easily understand the concept of time-frequency analysis. ShortTime Fourier Transform (STFT) of the signal x(t) is computed using the ‘hamming window’as the window function v(t).Hamming window of length 0.1 Sec (100 sample point) is shown in the Figure 1

Figure 1: Hamming window of length 100

The color bar on the right of the pictures represent the coefficient values in the figure. Highercoefficient values have the color of ‘dark red’ and lower coefficient values have the color of ‘darkblue’.

It can be observed from the figures that a window of smaller length provides better resolutionin time (Signal representation is well confined in time i.e no blurring across time) but poorresolution in frequency (Signal representation is not well confined in frequncy i.e. blurring

22 - 1

Page 2: WAVELETS AND MULTIRATE DIGITAL SIGNAL …nptel.ac.in/courses/117101001/downloads/Lec-22_Tutorial.pdf · WAVELETS AND MULTIRATE DIGITAL SIGNAL PROCESSING Lecture 22: Reconstruction

Figure 2: STFT of the signal x(t) with window length 0.1 Sec

Figure 3: STFT of the signal x(t) with window length 0.25 Sec

Figure 4: STFT of the signal x(t) with window length 0.5 Sec

22 - 2

Page 3: WAVELETS AND MULTIRATE DIGITAL SIGNAL …nptel.ac.in/courses/117101001/downloads/Lec-22_Tutorial.pdf · WAVELETS AND MULTIRATE DIGITAL SIGNAL PROCESSING Lecture 22: Reconstruction

Figure 5: STFT of the signal x(t) with window length 1 Sec

across frequency). Similarly, a window of larger length provides poor resolution in time (Signalrepresentation is not well confined in time i.e blurring across time) but better resolution infrequency ( Signal representation is well confined in frequncy i.e. no blurring across frequency).So, we can’t obtain a fine time resolution and a fine frequency resolution simultaneously. Byobserving the figure 5, (window length=1sec), we can say the distinct frequency’s in the signalx(t), because window of larger length provides provides better resolution in frequency. Byobserving the figure 1, (window length=0.1sec), we can say upto what time extent each distinctfrequncy is present.Computing the CWT of the signal x(t). Consider the wavelet function ψ(t) as shown in thefigure 6. Computing the coefficient values for different scales (s0=1 to 64) and for differentshift’s (τ) using the ’Matlab’ is shown in the figure 7. The color bar on the right of the picturesrepresent the coefficient values in the figure. Higher coefficient values have the color of ’darkred’ and lower coefficient values have the color of ’dark blue’.

It can be observed from the CWT that, in the time interval ]0,5[ most of the energy is con-centrated for the scale around 40 i.e. s0=40. Hence in that time interval the signal has thelowest frequency components. (f1=10 Hz) and in the time interval ]15,20[ most of the energyis concentrated for the scale around 4 i.e s0=4. Hence in that time interval the signal hasthe highest frequncy components (f4=100 Hz) and the frequency is 10 times (Ratio of scales)the frequency of signal in the range ]0,5[ (i.e. f4=10*f1) which is actually true. Similarly, byobserving the scale for which coefficients have the maximum value, in a given time interval, wecan calculate the frequency’s present in that time interval.Matlab code for generating the STFT is given below.

22 - 3

Page 4: WAVELETS AND MULTIRATE DIGITAL SIGNAL …nptel.ac.in/courses/117101001/downloads/Lec-22_Tutorial.pdf · WAVELETS AND MULTIRATE DIGITAL SIGNAL PROCESSING Lecture 22: Reconstruction

Figure 6: Wavelet function ψ(t)

Figure 7: CWT of signal x(t)

22 - 4

Page 5: WAVELETS AND MULTIRATE DIGITAL SIGNAL …nptel.ac.in/courses/117101001/downloads/Lec-22_Tutorial.pdf · WAVELETS AND MULTIRATE DIGITAL SIGNAL PROCESSING Lecture 22: Reconstruction

clear all;

%sampling frequency

fc=500;

%duration of the signal

T=20;

%zero padding factor

my_zero=10;

%generate the signal

t=linspace(0,T,fc*T);

x=zeros(1,length(t));

%thresholds

th1=0.25*T*fc;

th2=0.5*T*fc;

th3=0.75*T*fc;

th4=T*fc;

x(1:th1)=cos(2*pi*10*t(1:th1));

x((th1+1):th2)=cos(2*pi*25*t((th1+1):th2));

x((th2+1):th3)=cos(2*pi*50*t((th2+1):th3));

x((th3+1):th4)=cos(2*pi*100*t((th3+1):th4));

figure, plot(t,x);

win_len=100;

figure,[a,b,c]=spectrogram(x,win_len,0.2*win_len,win_len,fc);

colorbar;

surf(abs(c),abs(b),abs(a));

xlabel(’time’);

ylabel(’frequency’);

zlabel(’amplitude’);

figure,spectrogram(x,win_len,0.2*win_len,win_len,fc);

win_len=250;

figure,[a,b,c]=spectrogram(x,win_len,0.2*win_len,win_len,fc);

colorbar;

surf(abs(c),abs(b),abs(a));

xlabel(’time’);

ylabel(’frequency’);

zlabel(’amplitude’);

figure,spectrogram(x,win_len,0.2*win_len,win_len,fc);

win_len=500;

figure,[a,b,c]=spectrogram(x,win_len,0.2*win_len,win_len,fc);

colorbar;

surf(abs(c),abs(b),abs(a));

xlabel(’time’);

ylabel(’frequency’);

zlabel(’amplitude’);

22 - 5

Page 6: WAVELETS AND MULTIRATE DIGITAL SIGNAL …nptel.ac.in/courses/117101001/downloads/Lec-22_Tutorial.pdf · WAVELETS AND MULTIRATE DIGITAL SIGNAL PROCESSING Lecture 22: Reconstruction

figure,spectrogram(x,win_len,0.2*win_len,win_len,fc);

win_len=1000;

figure,[a,b,c]=spectrogram(x,win_len,0.2*win_len,win_len,fc);

colorbar;

surf(abs(c),abs(b),abs(a));

xlabel(’time’);

ylabel(’frequency’);

zlabel(’amplitude’);

figure,spectrogram(x,win_len,0.2*win_len,win_len,fc);

22 - 6