Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
INVERSE THEORY:
PRACTICAL EXERCISES REPORT
f (t)=cos(2 M t)=
f (t)=cos(2 M t)
1 2j t 2j
(e
+e
2
M
dt=
1 + 2j ( )t 2j (+
+e
(e
2
M
)t
) dt
1
( M ) (+ 0) ]
2[
f (t)=sin (2 M t )
1 2j t 2j
(e
e
2j
1 2j t 2j
(e
e
2j
M
dt=
1 + 2j ( )t 2j (+
e
(e
2j
M
)t
) dt
j
(+ M )( 0 ) ]
2[
c) Use matlab to compute the Discrete Fourier Transform of f (t)=cos(2 M t) and
f (t)=sin (2 M t ) and plot the amplitude and phase spectra; use M =5Hz
Why is the computed result different from the analytical result?
t=[0:0.001:4.95]
frax=[0:0.101:500];
nu=5;
f=cos(2*pi*nu*t);
g=fft(f)
subplot(3,1,1)
plot(t,f);
subplot(3,1,2)
plot(t,g)
axis([-1 6 -1000 2000])
subplot(3,1,3)
plot(frax,g)
axis([-100 600 -1000 2000])
2) Time and frequency domain. Link the ten given functions in the time domain to their
counterparts in the frequency domain.
3) Properties of the Fourier transform. The Fourier transform of f(t) is defined by:
+
FT ( F ( ))= f (t )= F ()e
1
2j t
dt
2j t
FT ( f ( t ))= f ( t) e
dt
1
1
>0 FT ( f ( t ))= f ( t) e2j t dt= u= dt = f ( u) e2 j u du =
du= dt
1
F
=
( )
<0 FT ( f ( t ))=
=
1
1
f (t )e2j t dt= u= dt = f ( u)e2 j u du =
du=dt
1
F()
QED
b) Linearity:
FT ( f (t)+ g (t ))= F ()+ G()
FT ( f + g)= ( f + g) e2j t d = f e2j t d + g 2j t d =
2j t
2j t
d + g
d = F ()+G ()
= f
QED
c) Time shifting
2j
FT ( f (t ))=e
F ( )
Let t '=tt 0 so t=t ' t 0
+
jt
j (t 't0)
dt= x (t ' )e
jt
dt ' =e
jt'
2j t
x (t ') e
dt '= X ( j )e
QED
dt
dt
dt
= FT 1 (2j F ())
QED
FT ( f g)=FT ( f ) FT ( g )
( g (t)e
) [
dt d = u=t
du=dt
2j (u )
2j
2j u
f ( )( g (u)e
dt ) d = f ( )e
d g (u)e
du=FT ( f ) FT ( g )
FT ( f g)=
2j t
=
QED
FT ( f (t))=F ()= f ( t) e
2j t
T
2
dt= e
2j t
e2j t
dt=
2j
T
2
T
sin( T )
sin ( T )
=T
= T sinc( T )
The rectangular pulse function g(t), centered at t=T/2, is defined as:
1 0<t<T
g (t )=0,5 t=0,T
0
else
b) Calculate FT(g(t)).
[ ]
T
2
T
t=+
2
dt=d
=t
( )
g (t )= f t
T
2
( ( ))
T
FT f t+
= f (t) e2j (t T / 2) d = e2j 2j T / 2 d =e j T e2j d =e j T F ()
2
0
0
c) Use Matlab to plot the amplitude and phase spectra of FT(f(t)) and FT(g(t))
t=[-10:1:10]
nu=[0:0.005:0.1]
f=vogon(t)
h=vogon2(t)
fur=fft(f)
gur=fft(h)
subplot(2,3,1)
plot(t,f)
axis([-10 10 0 5])
title('Centered Boxcar function')
xlabel('Time')
ylabel('Amplitude')
subplot(2,3,2)
plot(nu,fur)
axis([0 0.1 -10 10])
title('Centered Boxcar AS')
xlabel('Frequency')
ylabel('Amplitude')
subplot(2,3,3)
plot(nu,angle(fur))
c) Explain results and compute aliasing frequency. Look at the amplitude spectra. What does theory
tell you and what happened to the side lobes?
According to the Nyquist (or sampling) theorem, the minimum frequency able to sample without
losing information is C = MAX =2 2=2 75 Hz=150 Hz which yields a time lapse of
t C =6.67 ms .
Sampling at t 1=2 ms and t 2 =4 ms are still ok, this means that no information is lost,
unlike t 2 =8 ms , which yields a frequency under C , and it is even visible in the amplitude
spectrum plot that it gives a poor display of the function.
d) Extend the signal length by adding zeros at the end. Plot the resulting amplitude spectra of the
extended signal and explain.
t1=[0:0.002:1]
t2=[0:0.004:1]
t3=[0:0.008:1]
nu1=12.5
nu2=75
f1=cos(2*pi*nu1*t1)+cos(2*pi*nu2*t1)
f2=cos(2*pi*nu1*t2)+cos(2*pi*nu2*t2)
f3=cos(2*pi*nu1*t3)+cos(2*pi*nu2*t3)
F1=[f1,zeros(1,5)]
F2=[f2,zeros(1,5)]
F3=[f3,zeros(1,5)]
T1=[t1,zeros(1,5)]
T2=[t2,zeros(1,5)]
T3=[t3,zeros(1,5)]
subplot(3,1,1)
plot(T1,F1)
xlabel('Time')
ylabel('Amplitude')
title ('Time lapse of 2 ms')
subplot(3,1,2)
plot(T2,F2)
xlabel('Time')
ylabel('Amplitude')
title ('Time lapse of 4 ms')
subplot(3,1,3)
plot(T3,F3)
xlabel('Time')
ylabel('Amplitude')
title ('Time lapse of 8 ms')
2) In exercise (1) we have seen that the spectrum of the finite cosine corresponds to two sinc
functions centered at frequency of the cosine. In order to supress the side lobes of the spectral
window different time windows can be used, Barlett or Triangular Window, Hanning Window or
Gaussian Window. Compute the spectra for the same signal as in exercise (1) but use the three
windowing functions mentioned above.
t=[0:0.001:1]
nu1=12.5
nu2=75
L=1001
f=cos(2*pi*nu1*t)+cos(2*pi*nu2*t)
w=bartlett(L)
y=hann(L)
m=gausswin(L)
w=w'
y=y'
m=m'
h=w.*f
k=y.*f
s=m.*f
subplot(3,1,1)
plot(t,h)
xlabel('Time')
ylabel('Amplitude')
title ('Bartlett or Triangular Window')
subplot(3,1,2)
plot(t,k)
xlabel('Time')
ylabel('Amplitude')
title ('Hanning Window')
subplot(3,1,3)
plot(t,s)
xlabel('Time')
ylabel('Amplitude')
title ('Gaussian Window')
3) Linear filtering.
The wavelet b is given by [0,-1,0,1,2,4,3,1,0]. The delay filter f is given by [0,0,0,0,1].
a) Apply the delay filter to wavelet b. Plot the original and the delayed wavelet.
b) Compute and visualise the cross-correlation between b and b*f and explain how the time
difference between b and b*f can be estimated.
c) Perturb f with random noise. Compute and visualise the cross-correlation between the two
waveforms and determine the time shift.
b=[0,-1,0,1,2,4,3,1,0]
f=[0,0,0,0,1]
t=[0:1:14]
disp('DELAYED WAVELET:')
h=conv(b,f)
disp('CROSS CORRELATION:')
g=crosscorr(b,h)
disp('TIME DELAY:')
tau=-1+length(f)
amp=0.50
disp('RANDOM NOISE:')
noise=amp*rand(1,length(f))-amp/2
disp('PERTURBED f:')
fnew=f+noise
disp('DELAYED WAVELET W/ NOISE:')
hnoise=conv(b,fnew)
disp('CROSS CORRELATION W/ NOISE:')
gnoise=crosscorr(b,hnoise)
disp('AUTOCORRELATION OF NOISE:')
autocorr=crosscorr(noise,noise)
subplot(3,3,1)
stem(b)
axis([0 15 -5 5])
title('ORIGINAL WAVELET')
subplot(3,3,2)
stem(h)
axis([0 15 -5 5])
title('DELAYED WAVELET')
subplot(3,3,3)
stem(f)
axis([0 15 -5 5])
title('FILTER F')
subplot(3,3,4)
stem(fnew)
title('F WITH NOISE')
axis([0 20 -2 2])
subplot(3,3,5)
stem(hnoise)
title('DELAYED WAVELET WITH NOISE')
axis([0 20 -2 10])
subplot(3,3,6)
stem(gnoise)
title('CROSSCORRELATION WITH NOISE')
subplot (3,3,7)
stem(noise)
title('THE NOISE')
subplot (3,3,8)
stem(autocorr)
title('NOISE AUTOCORRELATION')
2) Butterworth filter. A Butterworth filter is a common form of a low pass filter defined by the
following amplitude spectrum.
1
F ( )=F ( ) F ( )=
2n
1+
C
Where C is the cut-off frequency, n is the number of poles which determines the rate of decay of the
() is the complex conjugate of F().
filter and F
a) Use the bilinear transformation to find an expression for F(z) for a second order Butterworth
filter (n=2). An expression can be obtained in the form F(z)=A(z)/B(z), where A(z) and B(z) are
polynomials in z.
b) Construct a second order (n=2) recursive Butterworth filter and give the impulse response.
c) Give the frequency response of a second-order Butterworth filter.
d) Apply the Butterworth filter to remove the noise from the signal in exercise 1.
( )
j c
j c
c
2sin 3 / 4 2 sin 3 / 4
F ( s )=
=
+
( ss 1)( ss 2)
( ss 1)
(ss 2 )
The bilinear transformation:
1z
1 1z
2j =2
=
1+z
j 1+z
Then:
c
sin ( C sin 3 / 4 ) e cos 3 / 4 z 1
sin 3 /4
=
F ( s)=
12cos( C sin 3 /4) e cos 3 / 4 z1+e 2 cos 3 / 4 z2
2
1
2
C (1+2z +z )
=
2
2
1
2
2
44 C cos 3 / 4+ c +(8+2 C ) z +(4+4 C cos 3 / 4+C ) z
C
H ( Z )=
1
, so:
G(Z )
1 5
H ( Z )= + Z which in the time domain is: h=(1/6,5/12)
6 12
In a second approach find the optimum inverse wavelet. What is the best deconvolution operator in
this case and why?
So
The best deconvolution operator would be the Wiener Filter, also known as the Optimal Inverse
Filter. Is the best approach because it minimises the error.
We have g=(6,5,1) and h=(h0,h1) is its inverse.
Convolving both of them:
g*h=(6h0 , 6h1 +5h0 , 5h1+h0, h1).
The error is:
ERR=( gh)=(6h 01, 6h 1+5h0 , 5h1+h0, h 1)
and its energy:
E 2=(6h 01)2+( 6h1+5h0 )2+(5h 1+h0 )2+h21=62 h20+62 h21+70 h1 h012 h01
The energy function has to be minimum, so:
E2
E2
df =
dh0+
dh1 =0 this means that the partial derivatives have to be zero.
h0
h1
So:
E2
=124 h 0+70 h112=0
h0 =0,02
h0
so h=(1/50,-7/500)
E2
=124 h 1+70 h 0=0
h1 =0,014
h 1
Substituting in the expression for the energy we get: E2=0,77, whereas the energy of the error when
doing the polynomial division is E2d=16,34. Therefore we can conclude that the Wiener filter yields
a much better approximation.
2) Consider the function x(t)=cos (20t) with 0=0,5Hz. Sample x(t) every second. Take six samples
in total. What happens if you sample every two seconds? In what follows we only consider the case
of a sampling interval of 1 second? Calculate the autocorrelation of x(t). Calculate the prediction
filter of length 2 which gives x6, the 7th sample of x(t). Compare the prediction to the true value. In
general, the predicted values of x(t) are given by x(t)*f(t). Give the succesive errors for these
predictions (r1,r2...) and comment.
nu=0.5
t1=[0:1:5]
t2=[0:2:5]
t3=[0:0.16:1]
x1=cos(2*pi*nu*t1)
x2=cos(2*pi*nu*t2)
x3=cos(2*pi*nu*t3)
g=xcorr(x1,x1)
h=xcorr(x2,x2)
w=xcorr(x3,x3)
subplot(3,1,1)
plot(t1,x1)
title('Sampling every second')
subplot(3,1,2)
plot(t2,x2)
title('Sampling every 2 seconds')
subplot(3,1,3)
plot(t3,x3)
title('Sampling interval of 1 second')
figure
subplot(3,1,1)
stem(g)
title('Autocorrelation of x1')
subplot(3,1,2)
stem(h)
title('Autocorrelation of x2')
subplot(3,1,3)
stem(w)
title('Autocorrelation of x3')
0
1.5227
2.0012
2.0012
1.5227
0;
0;
0;
0;
0
2.0309
0
0
0
0
0
0.4883
0;
0;
0;
0];