Professional Documents
Culture Documents
Bio-Signal Processing Lab Lect3
Bio-Signal Processing Lab Lect3
1
Aim of expt.
designing.
data.
2
Modeling Noise
A = rand(m,n);
3
Modeling Noise
A = randn(m,n);
4
Adding Noise in to a signal
Generate the following signal and create a noise signal.(show the plots).
5
Adding Noise in to a signal
n=0:0.1:50;
x= cos(0.04*pi*n);
subplot(1,2,1)
stem(n,x);
y= cos(0.04*pi*n)+ 0.2*(randn(size(x)));
subplot(1,2,2);
stem(n,y);
6
Filter Design
y=filter(b, a, x) , where :
b=[b0, b1, ..., bM]; a = [a0, a1, ..., aN];
are the coefficient arrays from the equation and x is the input
sequence
7
Filter Design
• The output y has the same length as input x.
>> n=0:6;
>> b=[b0,b1……,bn];a=[a0,a1,….an];
>> stem(n,h);
8
Example
9
Digital Filter
10
Filter design and implementation
11
Finite duration Impulse Response
12
Finite duration Impulse Response
13
FIR filter design
14
FIR filter Examples
1. Design a 18th-order FIR band pass filter with
normalized passband 0.35 0.65.
• Solution
b = fir1(18,[0.35 0.65]);
freqz(b,1,512)
15
Infinite Duration Impulse Response
16
IIR filter design
17
IIR Filter Design
Example 1:
Solution:
Cutoff frequency
order
[b,a] = butter(9,300/500,'high');
18
IIR Filter Implementation
2. Apply the filter you designed for input
x=sin(2*pi*50*t)+sin(2*pi*70*t) of sampling
frequency 1000Hz and cutoff frequency of
300Hz.
19
IIR Filter Implementation
t= 0:100;
x=sin(2*pi*50*t)+sin(2*pi*70*t);
subplot(1,2,1);
plot(t,x);
title('orignal_signal');
[b,a] = butter(9,300/500,'high');
y=filter(b,a,x);
subplot(1,2,2);plot(t,y);
title('filtered signal');
20
Homework
1. Design an 8th order chebyshev type II IIR filter for data sampled
2. What type of noises can be filtered with the filter you designed
code is a must).
21
Next class : ECG Signal processing
22