Digital Signal Processing Reference
In-Depth Information
MATLAB Simulation
Task 1
Write a MATLAB code to find the convolution of the two continuous-time
finite-length signals x(t) and h(t) as shown in Fig.
D.1
.
• Open a new m-file and give it a name (e.g., DSP_Exp1.m) and save it in your
directory.
• Choose a unified interval for
x
and
h
(i.e.,
a1
=
a2
=
-10, b1
=
b2
=
10
).
• Take
Ts
=
0.01
and define the time vector
t
.
• Express
x
and
h
first in terms of the unit step function, which is denoted in
MATLAB as
stepfun(t,to)
. On MATLAB command line, type [
help
stepfun
to see how this function works. Plot all step functions associated with
the functions
x
and
h
, then plot
x, h
, and their convolution
y
on the same
graph.
• Plot the theoretical convolution (see the Note below) and the numerical result on
another graph.
• Define all axes using xlabel and ylabel commands.
• Limit
the
axes
lengths
using
axis([x_min x_max y_min y_max])
command.
• Define all functions using
text(a,b,'text')
command to write on figures.
• Find the convolution using the fft-based algorithm and compare with the first
method.
Note: Using Fig.
D.1
we have:
y
ð
t
Þ¼
h
ð
t
Þ
x
ð
t
Þ¼
Z
h
ð
k
Þ
x
ð
t
k
Þ
dk
¼
Z
x
ð
t
k
Þ
dk
¼
Z
1
3
0
3e
2
ð
t
k
Þ
u
ð
t
k
Þ
dk
1
0
0
v
¼
t
k
¼
Z
t
3
3e
2v
u
ð
v
Þ
dv
¼
Z
t
3e
2v
u
ð
v
Þ
dv
!
t
t
3
8
<
9
=
0
;
t\0
½
Since u
ð
v
Þ¼
0 for v\0
3
R
t
e
2v
dv
¼ð
3
=
2
Þð
1
e
2t
Þ
t
0&t
3\0
!
0
t\3
¼
0
:
;
3
R
t
e
2v
dv
ð
3
=
2
Þ
e
2t
þ
6
t
0&t
3
0
!
t
3
:
t
3
Search WWH ::
Custom Search