150 10. IMPLEMENTATION VIA MATLAB CODER
L10.1 LAB EXERCISES
1. Use MATLAB to design an FIR filter based on the specifications noted below using the
fir2 function.
f = [0 300 600 1400 2000 4000]; %frequencies (0 to nyquist)
a = [0 .33 .89 .25 .60 0]; %desired amplitude response
order = 31; %filter order N
Follow the process outlined in the chapter and integrate these filter coefficients into the
MATLAB function. Use the MATLAB Coder to generate a C code; then deploy it onto
a smartphone target and verify its correct functionality.
2. Write a MATLAB function to implement an adaptive FIR filter to match an IIR filter
using the yulewalk function and the following specifications. Go through the steps dis-
cussed in the chapter to run this function on a smartphone target and verify its correct
functionality.
Nc=8; %8th order IIR
f=[0 .25 .33 .66 .67 1]; %frequency band definition
m=[0 .50 .20 1 0 0]; %gain definition
3. Write a MATLAB function to perform frequency-domain filtering and signal reconstruc-
tion. Go through the steps discussed in the chapter to run this function on a smartphone
target and verify its correct functionality. Use the same specifications as Lab L8 and com-
pare the processing time and the result with that of the implementation done in Lab L8.