## Lab 3 - Digital Signal Processing. Transfer Functions.

Version 1.0.0.0 (3 MB) by
Appropriate report, code files, functions and figures are added together into the archive.
Updated 16 Dec 2015

Exercise 1.1: I/O equation
Consider a second-order filter with the I/O equation: ...
(a) From the I/O equation, calculate the transfer function H(z) .
(b) From the coefficients of this transfer function (vectors: b = [b0 b1 b2] and a = [1 a1 a2]), write a MATLAB program to compute the first 100 samples of the impulse response, using the filter function.
(c) From the impulse response, complete your program to compute the magnitude (in dB) and phase (in °) spectra of the filter, using the fft, abs and angle functions.
(d) Display your results in a four quadrant figure (see template below) using the subplot function. To plot the pole/zero pattern, use the following code:
(e) Modify your program to set the coefficient a1 value to -1.9 and display the corresponding four quadrant figure. Give your comments on the pole/zero pattern and impulse response.
Exercise 2.1: Highpass filter
Pole/zero placements are useful to design simple filters. Consider a first-order highpass filter whose the
general transfer function is ...
where the coefficients a and b are positive and less than one. The gain G is fixed so as to normalize the
filter to unity at the highest frequency. Let’s define the parameter A as the attenuation of the lowest frequency
relative to the highest one. Additionally, a constraint is imposed on the filter speed response1 defined by two
parameters: eff n (number of samples to reach the steady state) and ... (steady state threshold in %).
(a) From H(z) , determine the frequency response H(w) where w is the digital frequency.
(b) From H(w) , determine the attenuation A as function of a and b .
(c) Determine the coefficient b as function of A and a .
(d) Determine the coefficient a as function of ... and eff n .
(e) Determine the normalization gain factor G as function of a and b .
(f) Write a MATLAB function HighPassFilter_NU to implement the filter, taking ... dB eff ... as input parameters and {b, a, G} as output parameters.
(g) Write a MATLAB program to test your function with the input parameter values ... and plot the magnitude spectrum (in dB) of the resulting filter.
(h) Modify your program to plot the magnitude spectra based on a collection of eff n values. Test it with ...
(i) Explain how the value eff n modifies the magnitude spectrum.

Exercise 2.2: Resonator filter
Consider the transform function of a normalized resonator filter with R = ...
(a) Express the filter coefficients (G, a1 and a2) in terms of sampling frequency fs, peak frequency f0 and width ....
(b) Write a MATLAB function ResonatorFilter_NU that returns the filter coefficients using fs, f0 and ..., as input parameters.
(c) Test your function with {30MHz, 2MHz, 0.5MHz} and plot the filter frequency response (magnitude spectrum in dB) over 0 < f <15MHz.
(d) Generate a 2 MHz sinusoidal signal corrupted by Gaussian noise (mean = 0, deviation standard = 0.5, use the randn function). Filter this noisy signal by the sample processing method2. Plot the 200 first samples of the noisy signal and filtered signal on the same figure.

Note!
Be careful with the results of resonator filter. Think I did not use the proper scale.

### Cite As

Sanzhar Askaruly (2024). Lab 3 - Digital Signal Processing. Transfer Functions. (https://www.mathworks.com/matlabcentral/fileexchange/54533-lab-3-digital-signal-processing-transfer-functions), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2015b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux
##### Categories
Find more on Signal Processing Toolbox in Help Center and MATLAB Answers