DSP Using Matlab® - 5
DSP Using Matlab® - 5
7. Multiplication
1
z [ x1( n )x2 ( n )] = ∫
2πj c
X 1( v ) X 2 ( z / v )v −1dv ROC : ROC x1 inverted ROC x 2
8. Convolution
z [ x1( n )* x2 ( n )] = X 1( z ) X 2 ( z ) ROC : ROC x1 ROC x 2
Properties of z-Transform
The important properties of the z-transform:
7. Multiplication
1
z [ x1( n )x2 ( n )] = ∫
2πj c
X 1( v ) X 2 ( z / v )v −1dv ROC : ROC x1 inverted ROC x 2
8. Convolution
z [ x1( n )* x2 ( n )] = X 1( z ) X 2 ( z ) ROC : ROC x1 ROC x 2
Find X 3 ( z ) = X 1 ( z ) X 2 ( z ) ?
From definition of the z-transforms,
x1 (n) = {2, 3, 4} x 2 (n) = {3, 4, 5, 6}
↑ ↑
x1 = [2,3,4]; x2 = [3,4,5,6];
x3 = conv(x1,x2)
x3 =
6 17 34 43 38 24
Hence
X 3 ( z ) = 6 + 17 z −1 + 34 z −2 + 43 z −3 + 38 z −4 + 24 z −5
Properties of z-Transform
Example 2:
We can use the “conv_m” function in to
multiply two z-domain polynomials
corresponding
X 1 ( z ) to
=z+noncausal
2 + 3 z −1 , X 2 ( z )sequences:
= 2 z 2 + 4 z + 3 + 5 z −1
Find
X 3 ( z) = X1 ( z) X 2 ( z) ?
x2 =
3 4 5 6
r =
0 0 0 0 0 0
z-Transform Pairs
z-Transform Pairs
Let’s look at one example:
( n −2 ) π
Determine the z-transform of x ( n ) = ( n − 2 )( 0 .5 ) cos[ (n − 2)]u (n − 2)
3
sol ) applying the sample − shift property
π
X ( z ) = z − 2 Z [n(0.5) n cos[ n]u (n)]
3
applying the differentiation in the z − plane property
π
dZ [(0.5) n cos[ n]u (n)]
= z − 2 [− z 3 ] ; no change in the ROC
dz
from table 4.1
1 − ( 0. 5 cos π ) z −1
π 3 1 − 0.25 z −1
Z [(0.5) cos[ n]u (n)] =
n
= ; z > 0.5
3 π
1 − 2(0.5 cos ) z + 0.25 z−1 −2
1 − 0 . 5 z −1
+ 0 . 25 z −2
3
−1 d 1 − 0.25 z −1 −1 − 0.25 z − 2 + 0.5 z −3 − 0.0625 z − 4
hence X ( z ) = − z ( −1 −2
)=− z
dz 1 − 0.5 z + 0.25 z 1 − z −1 + 0.75 z − 2 − 0.25 z −3 + 0.0625 z − 4
0.25 z −3 − 0.5 z − 4 + 0.0625 z −5
= ; z > 0 .5
1 − z −1 + 0.75 z − 2 − 0.25 z −3 + 0.0625 z − 4
z-Transform Pairs
In this example, we can see that the transform is
of the form X(z) = B(z)/A(z).
We can use the coefficients of B(z) and A(z) as
the “b” and “a” in the “filter” routine and excite
this routine with an impulse sequence, δ(n),
where Z[δ(n)] = 1. The output of “filter” will be
x(n).
This is a numerical approach of computing the
inverse z-transform.
We can compare this output with the given x(n) to
verify our z-transform X(z) is indeed the transform
of x(n).
z-Transform Pairs
The Matlab inplementation:
b= [0,0,0,0.25,-0.5,0.0625]; a = [1,-1,0.75,-0.25,0.0625];
[delta,n] = impseq(0,0,10)
delta =
1 0 0 0 0 0 0 0
n =
0 1 2 3 4 5 6 7
[R, p, C] = residuez(b,a)
[delta,n] = impseq(0,0,6);
x = filter(b,a,delta) % check sequence
x=
0.8
0.6
0.4
Imaginary Part
0.2
0
0 0.9
0.2
0.4
0.6
0.8
1
1 0.5 0 0.5 1
Real Part
Systems in The z-Domain
B. To plot the magnitude and phase response, we
use “freqz” function:
>> [H,w] = freqz(b,a,100);
>> magH = abs(H); phaH = angle(H);
>>
>> subplot(2,1,1); plot(w/pi,magH); grid
>> xlabel('frequency in pi units'); ylabel('Magnitude');
>> title('Magnitude Response')
>> subplot(2,1,2); plot(w/pi,phaH/pi); grid
>> xlabel('Frequency in pi units'); ylabel('Phase in pi units');
>> title('Phase Response')
Systems in The z-Domain
B. The plots:
Magnitude Response
12
10
Magnitude
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
frequency in pi units
Phase Response
0
Phase in pi units
0.1
0.2
0.3
0.4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Frequency in pi units
Systems in The z-Domain
B. Points to note:
We see the plots, the points computed is between
0<w<0.99π
Short at w = π.
To overcome this, use the second form of “freqz”:
>> [H,w] = freqz(b,a,200,’whole’);
>> magH = abs(H(1:101)); phaH = angle(H(1:101));
Now the 101st element of the array H will correspond to w =
π.
END!!!!