0% found this document useful (0 votes)
19 views34 pages

Biosignal Processing - digital systems realization

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views34 pages

Biosignal Processing - digital systems realization

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Biosignal Processing

Digital System Realization


Digital Signals
• Analog signals act as speech, audio, biomedical, and communications signals.
• Analog-to-digital conversion (ADC) process is used to process an analog signal using a digital
signal processor, for converting into digital signal
• The digital signal is processed via digital signal processing (DSP) algorithm(s)
• A typical digital signal x(n) is shown in Figure, where both the time and the amplitude of the
digital signal are discrete
Digital Functions
The basic digital functions (signal or sequence) are
• Unit Impulse Function

• Unit Step Function

• Unit Ramp Function

• Power Function
• Power functions take the form: x[n] = Aα βn
x[n] = (-0.6)n
• When α = e, such functions are called exponential functions.
• When β is positive, the function grows, and β is negative the function decays.
• When α is negative, the signal samples alternate positive and negative.
• The value of A is determine the magnitude/amplitude/value of the function when n = 0
3
Exponential Function
x[n] = e-0.5n
• Exponential functions take the form: x[n] = Ae βn
• Where e = 2.71828
• When β is positive, the function grows, and β is negative the function decays.
• When α is negative, the signal samples alternate positive and negative.
• The value of A is determine the magnitude/amplitude/value of the function
when n = 0

Sinusoidal Function

4
Linear System
• A linear system is illustrated in the figure.
• The linear system obeys the superposition principle.
• 𝑦1(𝑛) is the system output using an input 𝑥1(𝑛)
• 𝑦2(𝑛) the system output with an input 𝑥2(𝑛)
• The Linear system output due to the weighted sum inputs ∝𝑥1(𝑛) + 𝛽𝑥2(𝑛) is equal to the same
weighted sum of the individual outputs obtained from their corresponding inputs, that is, 𝑦(𝑛)
= ∝𝑦1(𝑛) + 𝛽𝑦2(𝑛), where ∝ and 𝛽 are constants.

5
Linear System (cont..) Example: A digital amplifier is represented by 𝑦(𝑛) = 10𝑥(𝑛), the input is
multiplied by 10 to generate the output.

𝑦 𝑛 = 2𝑦1 𝑛 + 4𝑦2 𝑛

Y(n)= 2(10u(n))+ 4(10d(n))

6
Time-Invariant System A time-invariant system is illustrated in the figure.

7
Time-Invariant System
Example: Determine whether the linear system y(𝑛) = 2𝑥(𝑛 − 5) is time invariant.

8
Causal System

Example: Determine whether the following systems are causal or not.

Solution

1) Causal
2) Non-causal
9
Difference Equation
• For digital system or filter, a difference equation is implemented, which may be represented in diagram or
equation form.
• The digital system with input and output is given below

• The digital system is represented by the following general form of difference equation

• Where x(n) and y(n) represented digital system’s input and output, the ai and bj represents the digital
system/filter co-efficient, n is the time index
• The DSP system output is the weighted summation of the current input value x(n) and its past values: x(n- 1), . .
. , x(n-M), and past output sequence: y(n -1), . . . , y(n - N).
• The aforementioned equation is called recursive difference equation, as this equation calculate a new output
from current and its past input and past output sequence.
Difference Equation (Cont…)
• A difference equation is said to be non-recursive, when inputs are required to
calculate the new output, such as,
y[n] = b0x[n] + b1x[n-1] + b2x[n-2] + … + bMx[n-M]
The compressed form of non-recursive difference equation is given by,

11
Example 1

Comparing it following equation


Example 2
Determine the following equation as a recursive or non recursive difference equation of a digital filter. Also, identify the
filter co-efficients (ak and bk) and determine the 5 samples of the output when input x[n] = 5 u[n]
y[n] = 0.5y[n-1] + x[n]
Solution
The difference equation is recursive as it output depends on past output and present input
Comparing the above equation with
Equation present in RHS

Therefore, a1 = -0.5, b0 = 1
5 samples points
since, y[n] = 0.5y[n-1] + x[n] and x[n] =5 u[n] therefore, the equation becomes
Y[n]= 0.5 y[n-1] + 5 u[n] | since u[n] values is always one (1) when n=0 to onwards
When n = 0, y[0] = 0.5y[0-1] + 5 = 0.5y[-1]+5u[0]=0.5(0) + 5 = 5 Y[n] = {5, 7.5, 8.75, 9.375, 9.6875}
When n = 1, y[1] = 0.5y[1-1] + 5 = 0.5y[0]+5u[1]= 0.5(5) + 5 = 7.5
When n = 2, y[2] = 0.5y[2-1] + 5 = 0.5y[1]+5u[2]= 0.5(7.5) + 5 = 8.75
When n = 3, y[3] = 0.5y[3-1] + 5 = 0.5y[2]+5u[2]= 0.5(8.75) + 5 = 9.375
When n = 4, y[4] = 0.5y[4-1] + 5 = 0.5y[3]+5u[3]= 0.5(9.375) + 5 = 9.6875
13
Difference Equation Diagram Elements
Delay Element

Coefficient Multiplier Element

Summer Element

Non-recursive Difference Equation Diagram


• The general form of the nonrecursive difference
equation is
y[n] = b0x[n] + b1x[n-1] + b2x[n-2] + … + bMx[n-M]

14
Nonrecursive Difference Equation Diagram
• In order to reduce quantization error of filter’s coefficient one strategy is to break higher order filter into second order chunks
Y1(n)= b01x(n)+b11x(n-1)+b21x(n-2)

Example: Draw a diagram for the difference equation


y[n] = 0.5x[n] + 0.4x[n-1] - 0.2x[n-2]

Figure: Cascaded second order non recursive filter


sections
Example: Write the difference equation of the following
diagram.

Y1(n)= b02(b01x(n)+b11x(n-1)+[b21x(n-2))+ b01x(n-1)+ 15


y[n] = x[n] - 0.3x[n-2] + 0.7x[n-3] b11x(n-2)+b21x(n-3)]b12
Difference Equation and Transfer Function
The Recursive difference equation of a digital system is given by,
Z {X(n-1)} = z-1 X(Z)

Taking Z-transform on both sides of above equation, by assuming all initial conditions of the digital systems are zero, yields,

Re-arranging above equation, we get

where H(z) is defined as the transfer function with its numerator and denominator polynomials defined below

Therefore, the z-transfer function is defined as

z-transfer function is represented in schematic form as


Example: 2y[n] + y[n-1] + 0.9y[n-2] = x[n-1] + Example: Find the difference equation that correspond to
x[n-4] transfer function.
2Y(z) + z-1Y(z) + 0.9z-2Y(z) = z-1X(z) + z-4X(z) 𝟏 + 𝟎.𝟖𝒛−𝟏
Y(z)/x(z)= 𝐇 𝒛 =
Factoring out Y(z) on the left side and X(z) on 𝟏 − 𝟎.𝟐𝒛−𝟏 +𝟎.𝟕𝒛−𝟐
the right side: Solution: Since H(z) = Y(z)/X(z), do the cross multiply to get
(2 + z-1 + 0.9z-2)Y(z) = (z-1 + z-4)X(z) (1 – 0.2z-1 + 0.7z-2)Y(z) = (1 + 0.8z-1)X(z)
The transfer function (TF) is
𝑌(𝑧) 𝑧 −1 +𝑧 −4 Then Y(z) – 0.5z-1Y(z) + 0.7z-2Y(z)= X(z) + 0.8z-1X(z)
H 𝑧 = =
𝑋(𝑧) 2+𝑧 −1 +0.9𝑧 −2 Finally taking the inverse z transform term by term to get

Example: y[n] = 0.75x[n] - 0.3x[n-2] – y[n] – 0.5y[n-1] + 0.7y[n-2]= x[n] + 0.8x[n-1]


0.01x[n-3]
Y(z) = 0.75X(z) - 0.3z-2X(z) – 0.01z-3X(z)
Factoring out Y(z) on the left side and X(z) on
the right side:
Y(z) = (0.75 - 0.3z-2 - 0.01z-3)X(z)
The transfer function (TF) is
𝑌(𝑧)
H 𝑧 = = 0.75 − 0.3𝑍 −2 − 0.01𝑍 −3
𝑋(𝑧)
Assignment # 4
Q1)

Q2)

Q3)
Realization of Digital Systems/Filters
• A realization is a hardware or software configuration that implements the system.
• Digital filters described by the transfer function H(z) and may be generally realized in the following forms:
1) Direct form I 2) Direct form II 3) Cascade 4) Parallel

Direct-Form I Realization
A digital filter transfer function, H(z), is given by

The digital filter transfer function is given by H(Z)=Y(Z)/X(Z) and therefore, Y(Z) = H(Z) X(Z)
Substituting the value of H(Z) in the above equation, we get,

−1 −𝑁 −1 −2 −𝑀
𝑌 𝑧 (1 + 𝑎1𝑍 + 𝑎2𝑧 − 2 + ⋯ + 𝐴𝑁𝑧 = 𝑏0 + 𝑏1𝑧 + 𝑏2𝑧 + ⋯ + 𝑏𝑀𝑍 X(z)

Taking the inverse of the z-transform of above equation, we yield the relationship between input x(n) and output y(n)
in time domain, as follows:
𝒚 𝒏 = 𝒃𝟎 𝒙 𝒏 + 𝒃𝟏 𝒙(𝒏 − 𝟏)+𝒃𝟐 𝒙 𝒏 − 𝟐 − 𝒂𝟏 𝒚 𝒏 − 𝟏 − 𝒂𝟐 𝒚(𝒏 − 𝟐)
Recursive Difference Equation Diagram
The general form of a recursive difference equation is
a0y[n] + a1y[n-1] + a2y[n-2] + … + aNy[n-N] = b0x[n] + b1x[n-1] + b2x[n-2] + … + bMx[n-M]
Example: Draw a direct form I diagram for the following
recursive difference equation
y[n] + 0.5y[n-2] = 0.8x[n] + 0.1x[n-1] - 0.3x[n-2]
y[n] = 0.8x[n] + 0.1x[n-1] - 0.3x[n-2] - 0.5y[n-2]

Example: Write the difference equation of the following diagram.

y[n] = -0.8x[n-1] +0.2x[n-3]+0.1y[n-1]-0.3y[n-2]+0.6y[n-3]


Direct-Form II Realization
A digital filter transfer function, H(z), is given by

By considering N=M, we get,


Cascade (Series) Realization

• When two or more systems are combined in cascade (in series), the transfer functions of the systems can be used to
determine a transfer function for the overall system. E.g. The transfer function of two systems H1(z) and H2(z) cascaded
together is H(z) = H1(z)H2(z)
Parallel Realization

• When two or more systems are combined in parallel the transfer functions of the systems can be used to
determine a transfer function for the overall system. E.g. The transfer function of the two systems connected in
parallel is H(z) = H1(z) + H2(z)
Example: Write the difference equation of the following diagram.

• The output of the bottom summer is 0.1x[n] – 0.3y[n]


• The output of the middle summer is 0.1x[n-1] – 0.3y[n-1] + 0.2x[n] – 0.2y[n]
• The final out top summer is y[n] = 0.1x[n-2] – 0.3y[n-2] + 0.2x[n-1] – 0.2y[n-1]
+ 0.8x[n]

26
Example 0.5−0.5𝑧 −2
Y(z)=X(𝑧) 1+1.3𝑧 −1+0.36𝑧 −2

Y(z) (1 + 1.3𝑧 −1 + 0.36𝑧 −2)=X(𝑧)(0.5 − 0.5𝑧 −2 )


Y(z) +1.3𝑧 −1 𝑌(𝑧) + 0.36𝑧 −2 𝑌(𝑧)=0.5X(𝑧) − 0.5𝑧 −2 𝑋(𝑧)
Y(z) = 0.5X 𝑧 − 0.5𝑧 −2 𝑋 𝑧 − 1.3𝑧 −1 𝑌 𝑧 − 0.36𝑧 −2 𝑌(𝑧)

Compare it with above equation for getting difference equation

For conversion in direct form I, compare the above equation


with following equation, to determine the co-efficients, we get
Example

For conversion in direct form II, compare the above equation Compare it with above equation for getting difference equation
with following equation, to determine the co-efficients, we get
Realization of Digital Systems
• In general, direct-form I or direct-form II realization is used,
whenever there is a second order filter module
• Cascade form is used for the high-order filter by doing
factorization the higher order filter with the first- or second-
order sections.
• In cases where the first order-filter is required, we can still
modify the second-order filter module by setting the
corresponding filter coefficients to be zero.

You might also like