Digital Signal Processing
By the end of this session, you will be able to:

Key Idea
A (linear, time‑invariant, causal) DSP system (digital filter) with input \(x(n)\) and output \(y(n)\) is described by an \(N\)th‑order linear difference equation:
\[ \begin{aligned} y(n) &= b_{0}x(n) + b_{1}x(n-1) + \cdots + b_{M}x(n-M) \\ &\quad - a_{1}y(n-1) - \cdots - a_{N}y(n-N) \end{aligned} \]
Or compactly:
\[ y(n)=\sum_{i=0}^{M} b_i x(n-i) - \sum_{j=1}^{N} a_j y(n-j) \]
Note
Digital filtering = recursively computing \(y(n)\) from the difference equation, given input \(x(n)\) and initial conditions.
System:
\[ y(n) = 0.5\,y(n-2) + x(n-1) \]
Identify coefficients:
Case (a) Nonzero initial conditions:
Compute for \(n=0,1,2,3\):
\[ \begin{aligned} x(0) &= (0.5)^0 u(0) = 1 \\ y(0) &= 0.5\,y(-2) + x(-1) = 0.5\cdot1 + (-1) = -0.5 \end{aligned} \]
\[ \begin{aligned} x(1) &= 0.5 \\ y(1) &= 0.5\,y(-1) + x(0) = 0.5\cdot0 + 1 = 1.0 \end{aligned} \]
\[ \begin{aligned} x(2) &= 0.25 \\ y(2) &= 0.5\,y(0) + x(1) = 0.5\cdot(-0.5) + 0.5 = 0.25 \end{aligned} \]
\[ \begin{aligned} x(3) &= 0.125 \\ y(3) &= 0.5\,y(1) + x(2) = 0.5\cdot1 + 0.25 = 0.75 \end{aligned} \]
Case (b) Zero initial conditions:
For \(n=0,1,2,3\):
\[ \begin{aligned} x(0) &= 1 \\ y(0) &= 0.5\,y(-2) + x(-1) = 0\cdot1 + 0 = 0 \end{aligned} \]
\[ \begin{aligned} x(1) &= 0.5 \\ y(1) &= 0.5\,y(-1) + x(0) = 0\cdot0 + 1 = 1 \end{aligned} \]
\[ \begin{aligned} x(2) &= 0.25 \\ y(2) &= 0.5\,y(0) + x(1) = 0.5\cdot0 + 0.5 = 0.5 \end{aligned} \]
\[ \begin{aligned} x(3) &= 0.125 \\ y(3) &= 0.5\,y(1) + x(2) = 0.5\cdot1 + 0.25 = 0.75 \end{aligned} \]
Notice:
Tip
For a stable filter, the effect of initial conditions decays over time.
System:
\[ y(n) = 2x(n) - 4x(n-1) - 0.5y(n-1) - y(n-2) \]
Initial conditions:
Goal: compute \(y(n)\) for \(n=0,\dots,19\) using MATLAB.
We pre‑allocate vectors for \(y(n)\) and embed initial conditions as extra entries:

filter() and filtic()General DSP form:
Coefficient vectors:
\[ A = [1\ a_1\ a_2\ \dots\ a_N] \] \[ B = [b_0\ b_1\ b_2\ \dots\ b_M] \]
Difference equation:
\[ y(n)=\sum_{i=0}^{M}b_i x(n-i)-\sum_{j=1}^{N} a_j y(n-j) \]
MATLAB syntax with initial conditions:
Zero initial conditions:
Note
filtic() maps your physical initial conditions \((x(-k), y(-k))\) into the internal state vector required by the filter() implementation (direct‑form II).
Recall system:
Case (a) Nonzero initial conditions
Output:
Case (b) Zero initial conditions
Output:
Given the general LTI difference equation with zero initial conditions:
\[ \begin{aligned} y(n) &= b_0 x(n) + b_1 x(n-1) + \cdots + b_M x(n-M) \\ &\quad - a_1 y(n-1) - \cdots - a_N y(n-N) \end{aligned} \]
Take the \(z\)-transform of both sides, using
We obtain:
\[ \begin{aligned} Y(z) &= b_0 X(z) + b_1 X(z) z^{-1} + \cdots + b_M X(z) z^{-M} \\ &\quad - a_1 Y(z) z^{-1} - \cdots - a_N Y(z) z^{-N} \end{aligned} \]
Rearrange:
\[ H(z) = \frac{Y(z)}{X(z)} = \frac{b_0 + b_1 z^{-1} + \cdots + b_M z^{-M}} {1 + a_1 z^{-1} + \cdots + a_N z^{-N}} = \frac{B(z)}{A(z)} \]
with
\[ B(z) = b_0 + b_1 z^{-1} + \cdots + b_M z^{-M} \]
\[ A(z) = 1 + a_1 z^{-1} + \cdots + a_N z^{-N} \]
Important
Transfer function definition
\[ H(z) = \frac{\text{$z$-transform of output}}{\text{$z$-transform of input}} = \frac{Y(z)}{X(z)} \]
Given:
\[ y(n) = x(n) - x(n-2) - 1.3\,y(n-1) - 0.36\,y(n-2) \]
\[ Y(z) = X(z) - X(z)z^{-2} - 1.3 Y(z)z^{-1} - 0.36 Y(z)z^{-2} \]
\[ Y(z)\big(1 + 1.3z^{-1} + 0.36z^{-2}\big) = (1 - z^{-2})X(z) \]
\[ H(z) = \frac{Y(z)}{X(z)} = \frac{1 - z^{-2}}{1 + 1.3z^{-1} + 0.36z^{-2}} \]
So:
Given:
\[ y(n) = x(n) - 0.5x(n-1) + 0.36x(n-2) \]
Take \(z\)-transform:
\[ Y(z) = X(z) - 0.5 X(z)z^{-1} + 0.36 X(z)z^{-2} \]
So:
\[ H(z) = \frac{Y(z)}{X(z)} = 1 - 0.5z^{-1} + 0.36z^{-2} \]
Tip
No feedback terms (\(a_j = 0\)) ⇒ the impulse response has finite length ⇒ FIR filter.
Given:
\[ H(z) = \frac{z^{2} - 1}{z^{2} + 1.3z + 0.36} \]
\[ H(z) = \frac{(z^{2}-1)/z^{2}}{(z^{2} + 1.3z + 0.36)/z^{2}} = \frac{1 - z^{-2}}{1 + 1.3z^{-1} + 0.36z^{-2}} \]
\[ \frac{Y(z)}{X(z)} = \frac{1 - z^{-2}}{1 + 1.3z^{-1} + 0.36z^{-2}} \]
\[ Y(z)(1 + 1.3z^{-1} + 0.36z^{-2}) = X(z)(1 - z^{-2}) \]
\[ y(n) + 1.3 y(n-1) + 0.36 y(n-2) = x(n) - x(n-2) \]
Rearranged:
\[ y(n) = x(n) - x(n-2) - 1.3 y(n-1) - 0.36 y(n-2) \]
Exactly the system from Example 6.3.
Given:
\[ H(z) = \frac{z^{2} - 0.5z + 0.36}{z^{2}} \]
Divide by \(z^{2}\):
\[ H(z) = \frac{Y(z)}{X(z)} = 1 - 0.5z^{-1} + 0.36z^{-2} \]
Thus:
\[ Y(z) = X(z) - 0.5 z^{-1}X(z) + 0.36 z^{-2}X(z) \]
Inverse \(z\)-transform:
\[ y(n) = x(n) - 0.5 x(n-1) + 0.36 x(n-2) \]
Same as Example 6.4.
Any rational \(H(z)\) can be factored as:
\[ H(z) = \frac{b_0 (z - z_1)(z - z_2)\cdots(z - z_M)} {(z - p_1)(z - p_2)\cdots(z - p_N)} \]
Given:
\[ H(z) = \frac{1 - z^{-2}}{1 + 1.3z^{-1} + 0.36 z^{-2}} \]
Multiply numerator & denominator by \(z^{2}\):
\[ H(z) = \frac{z^{2} - 1}{z^{2} + 1.3z + 0.36} \]
Solve roots:
Pole–zero form:
\[ H(z) = \frac{(z - 1)(z + 1)}{(z + 0.4)(z + 0.9)} \]
Impulse response \(h(n)\)
Response to input \(x(n) = \delta(n)\).
With \(X(z) = Z\{\delta(n)\} = 1\):
\[ h(n) = Z^{-1}\{H(z) X(z)\} = Z^{-1}\{H(z)\} \]
Step response (to \(x(n)=u(n)\), zero ICs):
\(X(z) = Z\{u(n)\} = \dfrac{z}{z-1}\).
\[ y(n) = Z^{-1}\Big\{ H(z) \frac{z}{z-1} \Big\} \]
General system response to arbitrary \(x(n)\):
In \(z\)-domain:
\[ Y(z) = H(z) X(z) \]
In time domain:
\[ y(n) = Z^{-1}\{Y(z)\} \]
Note
Equivalently, in time domain, for LTI systems:
\[ y(n) = (h * x)(n) = \sum_{k=-\infty}^{\infty} h(k)\,x(n-k) \]
(convolution).
System transfer function:
\[ H(z) = \frac{z+1}{z-0.5} \]
We will find:
We rewrite:
\[ \frac{H(z)}{z} = \frac{z+1}{z(z-0.5)} = \frac{A}{z} + \frac{B}{z-0.5} \]
Find residues:
At \(z=0\):
\[ A = \left. \frac{z+1}{z-0.5} \right|_{z=0} = \frac{0+1}{0-0.5} = -2 \]
At \(z=0.5\):
\[ B = \left. \frac{z+1}{z} \right|_{z=0.5} = \frac{1.5}{0.5} = 3 \]
Thus:
\[ \frac{H(z)}{z} = -\frac{2}{z} + \frac{3}{z-0.5} \]
Multiply both sides by \(z\):
\[ H(z) = -2 + \frac{3z}{z-0.5} \]
Inverse \(z\)-transform:
So:
\[ h(n) = -2\,\delta(n) + 3 (0.5)^n u(n) \]
Step input: \(x(n) = u(n)\), \(X(z) = \dfrac{z}{z-1}\).
Thus:
\[ Y(z) = H(z) X(z) = \frac{z+1}{z-0.5}\cdot\frac{z}{z-1} \]
Write:
\[ \frac{Y(z)}{z} = \frac{z+1}{(z-0.5)(z-1)} = \frac{A}{z-0.5} + \frac{B}{z-1} \]
Residues:
At \(z=0.5\):
\[ A = \left. \frac{z+1}{z-1} \right|_{z=0.5} = \frac{1.5}{-0.5} = -3 \]
At \(z=1\):
\[ B = \left. \frac{z+1}{z-0.5} \right|_{z=1} = \frac{2}{0.5} = 4 \]
So:
\[ Y(z) = \frac{-3z}{z-0.5} + \frac{4z}{z-1} \]
Inverse \(z\)-transform:
Hence step response:
\[ y(n) = -3 (0.5)^n u(n) + 4 u(n) \]
Input:
\[ X(z) = Z\{(0.25)^n u(n)\} = \frac{z}{z-0.25} \]
Then:
\[ Y(z) = H(z) X(z) = \frac{z+1}{z-0.5}\cdot\frac{z}{z-0.25} = \frac{z(z+1)}{(z-0.5)(z-0.25)} \]
Partial fraction:
\[ \frac{Y(z)}{z} = \frac{z+1}{(z-0.5)(z-0.25)} = \frac{A}{z-0.5} + \frac{B}{z-0.25} \]
Solving yields:
\[ Y(z) = \frac{6z}{z-0.5} - \frac{5z}{z-0.25} \]
Inverse \(z\)-transform:
\[ y(n) = 6(0.5)^n u(n) - 5(0.25)^n u(n) \]

z-plane basics
We plot poles and zeros of \(H(z)\) to analyze:

Given:
\[ H(z) = \frac{z^{-1}-0.5z^{-2}}{1 + 1.2z^{-1} + 0.45z^{-2}} \]
Convert to advanced form (positive powers) by multiplying numerator and denominator by \(z^{2}\):
\[ H(z) = \frac{(z^{-1}-0.5z^{-2})z^{2}}{(1+1.2z^{-1}+0.45z^{-2})z^{2}} = \frac{z - 0.5}{z^{2} + 1.2z + 0.45} \]
Find zeros and poles:
Zero: solve \(z - 0.5 = 0\) ⇒ \(z_1 = 0.5\).
Poles: solve \(z^{2} + 1.2z + 0.45 = 0\):
\[ p_1 = -0.6 + j0.3,\quad p_2 = -0.6 - j0.3 \]
Magnitude of poles:
\[ |p_{1,2}| = \sqrt{(-0.6)^2 + (0.3)^2} \approx 0.671 < 1 \]
So poles are inside the unit circle.

Pole–zero form:
\[ H(z) = \frac{z-0.5}{(z + 0.6 - j0.3)(z + 0.6 + j0.3)} \]
Continuous‑time sampled signal (sampling period \(T\)):
\[ x_s(t) = \sum_{n=0}^{\infty} x(nT)\,\delta(t-nT) \]
Laplace transform: using \(L\{\delta(t-nT)\}=e^{-nTs}\):
\[ X_s(s) = \sum_{n=0}^{\infty} x(nT)e^{-nTs} \]
One‑sided \(z\)-transform of sequence \(x(n)\):
\[ X(z) = \sum_{n=0}^{\infty} x(n) z^{-n} \]
Comparing terms, we see the mapping:
\[ z = e^{sT} \]
Let \(s = -\alpha \pm j\omega\):
\[ z = e^{-\alpha T \pm j\omega T} = e^{-\alpha T} \angle \pm\omega T \]
Conclusions:

A digital system is BIBO stable if every bounded input produces a bounded output.
For a rational \(H(z)\), stability is determined by pole locations:
Illustrations in Fig. 6.9:

We are given several transfer functions and asked to:
\[ H(z) = \frac{z+0.5}{(z-0.5)(z^2 + z + 0.5)} \]
\(z=0.5\), \(|z|=0.5 < 1\).
Roots of \(z^2 + z + 0.5 = 0\):
\[ z = -0.5 \pm j0.5,\quad |z| = \sqrt{0.5^2 + 0.5^2} \approx 0.707 < 1 \]
All poles inside unit circle ⇒ stable.
\[ H(z) = \frac{z^2 + 0.25}{(z-0.5)(z^2 + 3z + 2.5)} \]
\(z=0.5\), \(|z|=0.5<1\).
Roots of \(z^2 + 3z + 2.5 = 0\):
\[ z = -1.5 \pm j0.5,\quad |z| \approx 1.581 > 1 \]
Some poles outside unit circle ⇒ unstable.
\[ H(z) = \frac{z+0.5}{(z-0.5)(z^2 + 1.4141z + 1)} \]
\(z = 0.5,\ |z|=0.5<1\).
Roots of \(z^2 + 1.4141z + 1 = 0\):
\[ z \approx -0.707 \pm j0.707,\quad |z|\approx 1 \]
Outermost poles on unit circle, first order ⇒ marginally stable.
\[ H(z) = \frac{z^{2}+z+0.5}{(z-1)^2 (z+1)(z-0.6)} \]
Outermost pole at \(z=1\) is second order on unit circle ⇒ unstable.

From analog to digital frequency response:
For digital systems:
Thus digital frequency response:
\[ H(e^{j\omega T}) = H(z)\big|_{z=e^{j\omega T}} = \big|H(e^{j\omega T})\big| \angle H(e^{j\omega T}) \]
Define normalized digital radian frequency:
\[ \Omega = \omega T \]
Then we write:
\[ H(e^{j\Omega}) = H(z)\big|_{z=e^{j\Omega}} = \big|H(e^{j\Omega})\big| \angle H(e^{j\Omega}) \]
Note
In DSP, we typically work with \(\Omega \in [0,\pi]\) radians, corresponding to physical frequencies \(f \in [0, f_s/2]\).
Consider a digital filter with transfer function \(H(z)\) and sinusoidal input:

We can show (by partial fractions and inverse \(z\)-transform, as in the text) that the output has form:
\[ y(n) = y_{tr}(n) + y_{ss}(n) \]
where
General steady‑state result:
For input \(x(n) = K\sin(\Omega n)\,u(n)\),
\[ y_{ss}(n) = K\big|H(e^{j\Omega})\big| \sin\big(n\Omega + \angle H(e^{j\Omega})\big)u(n) \]
So:

1. Periodicity
From Euler’s identity:
\[ e^{j(\Omega + k2\pi)} = e^{j\Omega} \]
for integer \(k\). Thus:
2. Symmetry (for real‑coefficient filters)
Because of sampling:
Maximum useful frequency is the folding frequency \(f_s/2\).
Corresponding normalized radian frequency:
\[ \Omega = \omega T = 2\pi \frac{f_s}{2} T = \pi \]
Thus we only need \(\Omega \in [0,\pi]\).
Conversion to Hz:
\[ f = \frac{\Omega}{2\pi} f_s \]
Magnitude in decibels:
\[ |H(e^{j\Omega})|_{\text{dB}} = 20\log_{10}\big(|H(e^{j\Omega})|\big) \]
System:
\[ y(n) = 0.5x(n) + 0.5x(n-1) \]
This is a 2‑point moving average with equal weights.
\[ Y(z) = 0.5X(z) + 0.5z^{-1}X(z) \]
\[ H(z) = \frac{Y(z)}{X(z)} = 0.5 + 0.5z^{-1} \]
\[ \begin{aligned} H(e^{j\Omega}) &= 0.5 + 0.5 e^{-j\Omega} \\ &= 0.5 + 0.5\cos\Omega - j0.5\sin\Omega \end{aligned} \]
\[ |H(e^{j\Omega})| = \sqrt{(0.5+0.5\cos\Omega)^2 + (0.5\sin\Omega)^2} \]
\[ \angle H(e^{j\Omega}) = \tan^{-1}\left(\frac{-0.5\sin\Omega}{0.5+0.5\cos\Omega}\right) \]
Sampling rate \(f_s = 8000\) Hz.
| \(\Omega\) (rad) | \(f = \frac{\Omega}{2\pi}f_s\) (Hz) | \(|H(e^{j\Omega})|\) | \(|H(e^{j\Omega})|_{\text{dB}}\) | \(\angle H(e^{j\Omega})\) |
|---|---|---|---|---|
| 0 | 0 | 1.000 | 0 dB | \(0^\circ\) |
| \(0.25\pi\) | 1000 | 0.924 | −0.687 dB | −22.5° |
| \(0.50\pi\) | 2000 | 0.707 | −3.012 dB | −45° |
| \(0.75\pi\) | 3000 | 0.383 | −8.336 dB | −67.5° |
| \(1.00\pi\) | 4000 | 0.000 | −∞ | −90° |

Using \(\Omega = 0.25\pi + 2\pi\):
\[ |H(e^{j(0.25\pi + 2\pi)})| = |H(e^{j0.25\pi})| = 0.924 \]
\[ \angle H(e^{j(0.25\pi + 2\pi)}) = \angle H(e^{j0.25\pi}) = -22.5^\circ \]
Using \(\Omega = -0.25\pi\):
\[ |H(e^{-j0.25\pi})| = |H(e^{j0.25\pi})| = 0.924 \]
\[ \angle H(e^{-j0.25\pi}) = -\angle H(e^{j0.25\pi}) = +22.5^\circ \]

System:
\[ y(n) = x(n) - 0.5 y(n-1) \]
\[ Y(z) = X(z) - 0.5z^{-1}Y(z) \]
\[ H(z) = \frac{Y(z)}{X(z)} = \frac{1}{1 + 0.5z^{-1}} = \frac{z}{z + 0.5} \]
\[ H(e^{j\Omega}) = \frac{1}{1 + 0.5e^{-j\Omega}} = \frac{1}{1 + 0.5\cos\Omega - j0.5\sin\Omega} \]
\[ |H(e^{j\Omega})| = \frac{1}{\sqrt{(1+0.5\cos\Omega)^2 + (0.5\sin\Omega)^2}} \]
\[ \angle H(e^{j\Omega}) = -\tan^{-1}\left(\frac{-0.5\sin\Omega}{1+0.5\cos\Omega}\right) \]
Sampling rate \(f_s = 8000\) Hz.
| \(\Omega\) (rad) | \(f=\frac{\Omega}{2\pi}f_s\) (Hz) | \(|H(e^{j\Omega})|\) | \(|H(e^{j\Omega})|_{\text{dB}}\) | \(\angle H(e^{j\Omega})\) |
|---|---|---|---|---|
| 0 | 0 | 0.670 | −3.479 dB | \(0^\circ\) |
| \(0.25\pi\) | 1000 | 0.715 | −2.914 dB | 14.64° |
| \(0.50\pi\) | 2000 | 0.894 | −0.973 dB | 26.57° |
| \(0.75\pi\) | 3000 | 1.357 | 2.652 dB | 28.68° |
| \(1.00\pi\) | 4000 | 2.000 | 6.021 dB | \(0^\circ\) |

Starting from the general difference equation:
\[ y(n) = \sum_{i=0}^{M} b_i x(n-i) - \sum_{j=1}^{N} a_j y(n-j) \]
If all \(a_j = 0\), we get:
\[ y(n) = \sum_{i=0}^{M} b_i x(n-i) \]
If any \(a_j \neq 0\):
Tip
Summary
General LTI DSP system:
\[ y(n) = \sum_{i=0}^{M} b_i x(n-i) - \sum_{j=1}^{N} a_j y(n-j) \]
Transfer function:
\[ H(z) = \frac{Y(z)}{X(z)} = \frac{b_0 + b_1 z^{-1} + \cdots + b_M z^{-M}} {1 + a_1 z^{-1} + \cdots + a_N z^{-N}} = \frac{B(z)}{A(z)} \]
Pole–zero factorization:
\[ H(z) = \frac{b_0 (z - z_1)\cdots(z - z_M)} {(z - p_1)\cdots(z - p_N)} \]
Impulse response:
\[ h(n) = Z^{-1}\{H(z)\} \]
General response:
\[ Y(z) = H(z)X(z),\quad y(n) = Z^{-1}\{Y(z)\} \]
Mapping between domains:
\[ z = e^{sT},\quad s = -\alpha \pm j\omega \]
Stable continuous pole (\(\alpha>0\)) ⇒ \(|z| = e^{-\alpha T} < 1\)
Digital frequency response:
\[ H(e^{j\Omega}) = H(z)\Big|_{z=e^{j\Omega}},\quad \Omega = \omega T \]
Magnitude (dB) and phase:
\[ |H(e^{j\Omega})|_{\text{dB}} = 20\log_{10}\big(|H(e^{j\Omega})|\big) \]
\[ \angle H(e^{j\Omega}) = \arg\big(H(e^{j\Omega})\big) \]
\[ y_{ss}(n) = K|H(e^{j\Omega})|\sin\big(n\Omega + \angle H(e^{j\Omega})\big)u(n) \]
FIR vs IIR:
We start from the system in Example 6.1:
\[ y(n) = 0.5\,y(n-2) + x(n-1) \]
Input: (x(n) = (0.5)^n u(n)).
Use Python to compute the first few samples and compare to the textbook.
Use sliders to switch between nonzero and zero initial conditions and instantly see the outputs.
Now let’s implement a general LTI filter:
\[ y(n) = \sum_{i=0}^{M} b_i x(n-i) - \sum_{j=1}^{N} a_j y(n-j) \]
We will allow students to edit (a_j), (b_i), and choose an input signal.
viewof b_coeffs = Inputs.text(
"1.0, -0.5, 0.25",
{label: "b coefficients (comma-separated, b0, b1,...,bM)"}
)
viewof a_coeffs = Inputs.text(
"0.0, 0.5",
{label: "a coefficients (comma-separated, a1,...,aN) [enter 0.0 for none]"}
)
viewof input_type = Inputs.select(
["unit step", "exponential 0.8^n", "impulse"],
{label: "Input x(n) type", value: "unit step"}
)
viewof N_len = Inputs.range(
[10, 200],
{step: 10, value: 100, label: "Number of samples"}
)We now plot poles and zeros in the (z)-plane and classify stability.
We now link pole–zero structure with frequency response (H(e^{j})).
Students choose FIR or IIR coefficients and see (|H(e^{j})|) and phase vs frequency.
viewof B_freq = Inputs.text(
"0.5, 0.5",
{label: "B(z) coefficients for freq response (b0,...,bM, highest power to constant)"}
)
viewof A_freq = Inputs.text(
"1.0, 0.0",
{label: "A(z) coefficients for freq response (a0,...,aN, highest to constant) [a0 must be 1 for proper H(z)]"}
)
viewof fs = Inputs.range(
[1_000, 24_000],
{step: 1_000, value: 8_000, label: "Sampling frequency f_s (Hz)"}
)
viewof log_scale = Inputs.checkbox(
["Show magnitude in dB"],
{label: "Options", value: []}
)We now connect (H(e^{j})) to the time‑domain steady‑state response.
For input:
\[ x(n) = K \sin(\Omega n) \]
The steady‑state output is:
\[ y_{ss}(n) = K |H(e^{j\Omega})| \sin\big(\Omega n + \angle H(e^{j\Omega})\big) \]
Let’s pick a specific filter (e.g., Example 6.10’s 2‑point averager) and vary input frequency.
viewof K_amp = Inputs.range(
[0.1, 2.0],
{step: 0.1, value: 1.0, label: "Input amplitude K"}
)
viewof norm_Omega = Inputs.range(
[0.0, 1.0],
{step: 0.05, value: 0.25, label: "Normalized frequency Ω/π (0 to 1)"}
)
viewof N_time = Inputs.range(
[20, 200],
{step: 10, value: 80, label: "Number of time samples for plot"}
)Compare a simple FIR and a simple IIR filter’s impulse responses side by side.
viewof FIR_b = Inputs.text(
"0.5, 0.5",
{label: "FIR b coefficients (highest power to constant)"}
)
viewof IIR_B = Inputs.text(
"1.0",
{label: "IIR numerator B(z) (highest power to constant)"}
)
viewof IIR_A = Inputs.text(
"1.0, 0.5",
{label: "IIR denominator A(z) (highest to constant, a0=1)"}
)
viewof N_imp = Inputs.range(
[10, 200],
{step: 10, value: 80, label: "Impulse response length N"}
)Use these interactive blocks to: