Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

Teknik Pengolahan Isyarat Digital

(TE 3325)
© 2022-Teknik Elektro
Topic 6:
Implementation of Discrete-Time
Systems (2)
@2022-Lecture slides prepared by Lasmadi
Deskripsi Topik
• In practice, system design and implementation are usually treated
jointly rather than separately. Often, the system design is driven by the
method of implementation and by implementation constraints, such as
cost, hardware Iimitations, size limitations, and power requirements. At
this point, we have not as yet developed the necessary analysis and
design tools to treat such complex issues. However, we have developed
sufficient background to consider some basic implementation methods
for realizations of LTI systems described by linear constant-coefficient
difference equations.
Capaian Pembelajaran
• Mampu memahami konsep struktur untuk realisasi sistem
LTI (Linear Time-Invariant Systems)
• Mampu memahami konsep realisasi recursive dan
nonrecursive dari FIR Systems.
Contents
• Structures for the Realization of Linear Time-Invariant
Systems
• Recursive and Nonrecursive Realizations of FIR Systems
Pers. Difference Sistem IIR
• Pers. difference (beda) filter IIR:

=− − + ( − ) atau ( )= ( − )− ( − ) (6.1)

• Secara function, sistem filter IIR dinyatakan sbb:

( ) ∑ + +. . . +
( )= = =
( ) ∑ + +. . . +

• Dengan bn dan an adalah koefisien filter, dan a0=1. Orde filter IIR sama dg N jika aN
≠ 0.
Pers. Difference Sistem IIR Direct form I structure

• Ada beberapa cara untuk implementasi filter IIR


berdasar pers. Difference diatas: bentuk langsung
(direct form), bentuk kaskade (cascade), dan bentuk
paralel.
• Direct form (bentuk langsung), misalkan M=N=4,
persamaannya menjadi:

( )= ( )+ ( − )+ ( − )+ ( − )+ ( − )
− ( − )− ( − )− ( − )− ( − )

• Dapat diimplementasikan dg struktur direct form 1 atau


direct form 2.

Direct form II structure


Example
• Filter IIR dinyatakan dengan fungsi sbb:
1+0 + 2−
( )=
1 − 0.8 + 0.6 1 − 0.75
• Gambarkan struktur direct form I dan II.
• Sol.:
1+0 + 2−
( )=
1 − 0.8 + 0.6 1 − 0.75

2+2 − −
=
1 − 0.8 + 0.6 − 0.75 + 0.6 + 0.45

2− +2 −
=
1 − 1.55 + 1.26 + 0.45
• Direct form I structure
• …

• Direct form II structure


• …
Persamaan Difference Sistem FIR
• Pers. difference filter FIR :

( )= ( )+ ( − )+. . . + ( − − )

• Bila orde filter = M, maka panjang filter adalah M+1 atau L (= jml koefisien yg ada).

• Dalam bentuk fungsi, filter FIR dinyatakan sbb.

( )= + +. . . + =

• Sehingga, tanggapan impuls h[n] adalah:

_0 ≤ ≤ −1
ℎ[ ] =
0 _
Persamaan Difference Sistem FIR
• Misalkan filter FIR orde 4, mk pers. difference nya mjd:

( )= ( )+ ( − 1) + ( − 2) + ( − 3) + ( − 4)

• Struktur direct form dpt digambarkan (bentuk yg disederhanakan),

z-1 z1 z-1 z-1

+ + + +
Example 2
• Filter FIR dinyatakan dengan pers. Difference sbb.
| |
1
( )= ( − )
2

• Tentukan diagram blok struktur bentuk langsungnya.


| |
• Sol.: 1
( )= ( − )
2
.
1 1 1 1 1
( )= ( )+ ( − 1) + ( − 2) + ( − 3) + ( − 4) + ( − 5)
2 2 2 2 2
1 1 1 1 1
+ ( − 6) + ( − 7) + ( − 8) + ( − 9) + ( − 10)
2 2 2 2 2
• Atau
= 0,03125 + 0,0625 − 1 + 0,125 − 2 + 0,25 − 3 + 0,5 −4 + −5
+0,5 − 6 + 0,25 − 7 + 0,125 − 8 + 0,0625 − 9 + 0,03125 ( − 10)
• … = 0,03125 = 0,5
= 0,0625 = 0,5
= 0,125 = 0,125
= 0,25 = 0,0625
= 0,5 = 0,03125
=1
• Anda dapat mencoba menggambarkan diagram blok struktur direct form nya
sendiri.
Implementasi Persamaan Diff. Sistem FIR
• Suatu persamaan beda nonrecursive FIR filter memiliki bentuk umum sebagai:

• Misal, ini akan diimplementasikan ke suatu FIR filter dengan koefisien {bk} = {3, -1,
2, 1}, (maka kita memiliki suatu sequen 4 dengan M=3).
• Hal ini dapat diekspansi ke dalam bentuk pers. difference 4-titik menjadi:

• M disebut orde filter dan L disebut koefisien filter atau panjang filter, L=M+1.
Implementasi Persamaan Diff. Sistem FIR
• Bila kita tetapkan bahwa {bk} = {1,1,1}. Untuk y[n], bisa kita tuliskan sebagai

• Bila kita rubah {bk}= {1,1,1,1,1,1,1}, maka akan didapatkan:

• Sekarang, kita coba untuk mendapatkan jika y[n] sebagai yn[n] secara umum:
Implementasi Persamaan Diff. Sistem FIR
• Bentuk sekuen {bk}  “menjadi suatu sekuen h[k]” maka akan didapatkan sebagai:

ini dikenal juga sebagai “convolution sum” .  y[n]=x[n]*h[n].


• Mengapa…. ???
• Dalam hal ini penjelasannya adalah:
h[n] = bk = bn;  yang merupakan koefisien-koefisien
The Impulse Response of a LTI Recursive System
• The impulse response of a linear time-invariant system was previously defined as
the response of the system to a unit sample excitation [i.e., x(n) = δ(n)]. In the case
of a recursive system, h(n) is simply equal to the zero-state response of the system
when the input x(n) = δ(n) and the system is initially relaxed.
• For example, in the simple first-order recursive system given as,

• With x(n) = δ(n) is substituted into eq., we obtain:

• Hence the impulse response of the first-order recursive system described by,
The Impulse Response of a LTI Recursive System
• In the general case of an arbitrary, linear time-invariant recursive system, the zero-
state response expressed in terms of the convolution summation is

• When the input is an impulse [i.e.. x(n) = δ(n)], reduces to

• In the case where the excitation is an impulse, the particular solution is zero, since
x(n) = 0 for n > 0, that is,
Transformasi–Z
• Konsep pemikiran
“domains of representation”:
 Domain-n (discrete time):
Sequence, impulse response, pers.difference (pers.beda).
 Domain-w
Freq. Response, spectral representation.
 Domain-z
Operator dan pole-zero.
• Apabila suatu kasus sulit dipecahkan pada suatu domain tertentu,
maka transformasi ke domain yang lain akan dimungkinkan dapat
menyelesaikannya.
Transformasi–Z
• Proses pengolahan audio secara digital:
- analisis langsung sulit:
 transformasi z untuk mendapat analitis mudah
dengan operasi aljabar (domain-z).
- analisis frekuensinya
 dalam domain-w.
- implementasinya:
dalam domain-n.
Transformasi Z
• Persamaan untuk transformasi Z mirip dengan persamaan transf. Fourier,
yaitu:
(1)

• dengan z adalah sembarang variabel kompleks. Jika diidentifikasikan


dengan sebuah runtun data (seperti x[n]), z-n menyatakan pergeseran
sebanyak n sampel, atau sama dengan pergeseran waktu sepanjang nTs
detik.

• Sifat pergeseran dari z-n dapat dinyatakan sebagai,

(2)
Transformasi Z
• Sebagai contoh, karakteristik transf. Z dapat digunakan untuk proses tunda satu
satuan seperti diperlihatkan pada Gambar 1.

Gambar 1.
• Pada proses yang digambarkan tsb maka output sistem adalah sama dengan
inputnya namun tertunda satu sampel. Atau proses tunda satu satuan yang
menggeser data sebanyak satu data (sampel).
• Pangkat n yang lain dapat digunakan untuk tundaan yang lebih besar.
Transfer Function
• Transfer Function (fungsi tranfer) didefinisikan sebagai,

• Untuk proses yang digambarkan pada Gambar 1, fungsi transfernya adalah H(z) = z-1.
• Namun sebagian besar fungsi transfer mempunyai bentuk yang lebih kompleks,
melibatkan polinomial dalam z pada pembilang dan penyebutnya. Contoh persamaan
berikut.

• Orde penyebut yaitu D dapat kurang/sama/lebih besar daripada orde pembilang yaitu
N. Sistem dengan orde penyebut = 1 akan lebih stabil daripada orde yang lebih tinggi.
Example: x[n] to H[z]
• Temukan bentuk pers. ini dalam domain z:

• Penyel.:
• Ditabelkan;

• Untuk domain – z akan didapatkan sebagai,


Example: H[z] to x[n]
• Diketahui suatu sistem dalam domain-z memiliki bentuk seperti berikut:

• Penyel.:
• Dengan cara yang sama akan kita dapatkan bentuk sbb:

Kita dapatkan bentuk dalam domain-n sebagai:


Transformasi-Z pada Suatu Filter FIR
• Jika x[n]=zn berlaku untuk semua nilai n, maka

Maka:

System Function
Filter

Sehingga:
Example: y[n] – H[z] - Zero
• Suatu filter FIR dinyatakan sebagai:

• Dapatkan bentuk dalam domain-z dan nilai zeronya.


• Penyel.:
Dengan cara yang sama dengan logika pada contoh sebelumnya maka
didapatkan bentuk dalam domain–z sebagai berikut :

• Dengan mengacu pada bentuk terakhir persamaan diatass, didapatkan


bahwa nilai zero terjadi pada z = 1/3 dan z = ½ .
Example: h[n] – H[z]
• Suatu filter FIR memiliki system function dalam domain–n sebagai berikut:

• Dapatkan representasinya dalam domain-z.

• Penyel.:
Dengan cara yang sama kita dapatkan bentuk domain-z sebagai:
Example: H[z] – h[n]
• Dapatkan bentuk respon impulse suatu filter FIR dengan fungsi sistem yang
direpresentasikan dalam domain–z sebagai berikut.

• Penyel.:
( )= ( − )− ( − )
Matlab Implementation
• A function called filter is available to solve difference equations numerically, given the input and the
difference equation coefficients. In its simplest form this function is invoked by
y = filter(b,a,x)
where
b = [b0, b1, ..., bM]; a = [a0, a1, ..., aN];

are the coefficient arrays from the difference equation given in (6.1), and x is the input sequence array.
The output y has the same length as input x. One must ensure that the coefficient a0 not be zero.
• To compute and plot impulse response, MATLAB provides the function impz. When invoked by

h = impz(b,a,n);
it computes samples of the impulse response of the filter at the sample indices given in n with
numerator coefficients in b and denominator coefficients in a. When no output arguments are given,
the impz function plots the response in the current figure window using the stem function.
Matlab Implementation
• EXAMPLE 2.11 Given the following difference equation

a. Calculate and plot the impulse response h(n) at n = −20,..., 100.


b. Calculate and plot the unit step response s(n) at n = −20,..., 100.
c. Is the system specified by h(n) stable?

• Solution: From the given difference equation the coefficient arrays are
b = [1]; a=[1, -1, 0.9];

• …
Matlab Implementation
• a. MATLAB script:

>> b = [1]; a = [1, -1, 0.9]; n = [-20:120];


>> h = impz(b,a,n);
>> subplot(2,1,1); stem(n,h);
>> title(’Impulse Response’); xlabel(’n’); ylabel(’h(n)’)

The plot of the impulse response is shown in Figure 2.9.


• b. MATLAB script:
>> x = stepseq(0,-20,120); s = filter(b,a,x);
>> subplot(2,1,2); stem(n,s)
>> title(’Step Response’); xlabel(’n’); ylabel(’s(n)’)
The plot of the unit step response is shown in Figure 2.9.
Matlab Implementation
• .

FIGURE 2.9 Impulse response and step response plots in Example 2.11
Matlab Implementation
• c. To determine the stability of the system, we have to determine h(n) for all n. Although we
have not described a method to solve the difference equation, we can use the plot of the
impulse response to observe that h(n) is practically zero for n > 120. Hence the sum |h(n)|
can be determined from MATLAB using
>> sum(abs(h))
ans = 14.8785

• which implies that the system is stable. An alternate approach is to use the stability condition
(2.23) using MATLAB’s roots function. |zk| < 1, k = 1,...,N (2.23)

>>z = roots(a); magz = abs(z)


magz = 0.9487
0.9487

• Since the magnitudes of both roots are less than one, the system is stable. □
Matlab Implementation
• EX.: 2.12 Let us consider the convolution given in example. The input sequence is of finite
duration
x(n) = u(n) − u(n − 10)
while the impulse response is of infinite duration
h(n) = (0.9)n u(n)
• Determine y(n) = x(n) ∗ h(n).
• Sol. :
If the LTI system, given by the impulse response h(n), can be described by a difference
equation, then y(n) can be obtained from the filter function. From the h(n) expression
(0.9) h(n − 1) = (0.9) (0.9)n−1 u(n − 1) = (0.9)n u(n − 1)
or h(n) − (0.9) h(n − 1) = (0.9)n u(n) − (0.9)n u(n − 1)
= (0.9)n [u(n) − u(n − 1)] = (0.9)n δ(n)
= δ(n)
Matlab Implementation
• The last step follows from the fact that δ(n) is nonzero only at n = 0. By definition h(n) is the
output of an LTI system when the input is δ(n). Hence substituting x(n) for δ(n) and y(n) for
h(n), the difference equation is
y(n) − 0.9y(n − 1) = x(n)

• Now MATLAB’s filter function can be used to compute the convolution indirectly.

>> b = [1]; a = [1,-0.9];


>> n = -5:50; x = stepseq(0,-5,50) - stepseq(10,-5,50);
>> y = filter(b,a,x);
>> subplot(2,1,2); stem(n,y); title(’Output sequence’)
>> xlabel(’n’); ylabel(’y(n)’); axis([-5,50,-0.5,8])

• The plot of the output is shown in Figure 2.10.


Matlab Implementation
• .

FIGURE 2.10 Output sequence in Example 2.12


Summary
• In summary, we can think of the terms FIR and IIR as general
characteristics that distinguish a type of linear time-invariant system,
and of the terms recursive and nonrecursive as descriptions of the
structures for realizing or implementing the system.
Thanks for your attentions

You might also like