

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The instructions for a lab exercise in applied biomedical signal processing, focusing on filter design and implementation using matlab. Students are required to plot the frequency response of a discrete-time filter, filter a discrete-time signal, implement a filter to remove baseline wander, and implement a moving average filter. The necessary code and data files for completing the exercise.
Typology: Study notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Today we have the following goals
At the end of class you should turn in two plots and answers to some questions.
There are five input arguments to laptop3.m:
laptop3(0.8,21,’ecg_bn.dat’,1,3000);
If you have done everything correctly so far, it should plot the original signal.
H(z) =
1 − z−^1 1 − αz−^1
1 + α 2
Here α is the location of the pole we will use so the filter will (hopefully) remove the low fre- quency components of the signal while leaving the remaining frequency components alone.
Matlab generally expects a filter to be of the form
H(z) =
b 1 + b 2 z−^1 + b 3 z−^2 + ... + bN +1z−N a 1 + a 2 z−^2 + a 3 z−^2 + ... + aN +1z−N
and to implement the filter in Matlab we enter the b and a coefficients as vectors,
b = [b1 b2 b3 ... bN]; a = [a1 a2 a3 ... aN];
Note that the lengths of the a and b vectors must be the same, which usually means you need to pad the a vector with zeros.
Determine the correct a and b vectors for our filter to remove baseline wander, and type it into laptop3.m. Your coefficients should be a function of the variable ‘alpha’ which is passed to the function.
p = filter(b,a,x);
Modify your Matlab code to so the input signal can be filtered using the filter you implemented in part 3. Call your filtered signal p.
[H1,Omega1] = freqz(b,a);
Implement this in Matlab for your filter. Note that in order to convert this frequency to a real frequency we need to scale using freal = Ω π^1 f 2 s where fs is the sampling frequency and freal corresponds to the real frequency.
Uncomment the plotting parts of the code at the bottom of laptop3.m, and run laptop3.m using α = 0.8 you should get plots like those shown in Figure 1. (There are more plots here that you have so far).
We next need to implement the moving average filter. The input signal to this filter will be p, which was the output of our first filter, and the output of the filter will be y. The easiest way to implement this is with the Matlab code
a = zeros(1,order); a(1) = 1; b = ones(1,order)/order;
Implement this in latop3.m and put in the code to filter p to get y. Next put in code to determine the frequency response of the MA filter. Finally modify the code to plot all of the results. If you have done everything correctly you should get the same graph as in Figure 1 (if you use α = 0.8 and order = 21).