Biosignal Processing - digital systems realization
Biosignal Processing - digital systems realization
• 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 𝑛
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
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
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
Summer Element
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)
Taking Z-transform on both sides of above equation, by assuming all initial conditions of the digital systems are zero, yields,
where H(z) is defined as the transfer function with its numerator and denominator polynomials defined below
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]
• 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.
26
Example 0.5−0.5𝑧 −2
Y(z)=X(𝑧) 1+1.3𝑧 −1+0.36𝑧 −2
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.