Adaptive Filters and Active Noise Cancelation - PowerPoint PPT Presentation

About This Presentation
Title:

Adaptive Filters and Active Noise Cancelation

Description:

Adaptive Filters and Active Noise Cancelation – PowerPoint PPT presentation

Number of Views:420
Avg rating:3.0/5.0
Slides: 18
Provided by: jasond9
Category:

less

Transcript and Presenter's Notes

Title: Adaptive Filters and Active Noise Cancelation


1
Adaptive Filters and Active Noise Cancelation
  • Instructor Jason D. Bakos

2
Signals
  • Represented as a mapping between time and
    magnitude

Dt
freq1/Dt
  • Sample at regular intervals

.5Dt
sample rate2/Dt
3
Signals
  • Sampling allows a signal to be represented as a
    discrete function over non-negative integers
  • s(n)
  • vector form
  • 0.243 1.231 0.445 3.122

aliasing adding harmonics of the sampling
frequency to a sampled signal makes it appear the
same
4
The FIR Filter
  • Finite Impulse Response
  • Set of coefficients that change a signal through
    convolution
  • M-1 is the order (memory) of the filter
  • Example
  • b .2 .1 .5
  • x 1 5 2 4 3
  • y .2 1.1 1.4 3.5 2.0
  • Zero-pad the right side of the signal value and
    we do convolution
  • Example (2x2 4x 3) (4x2 3x 2)

5
The FIR Filter
  • Filter the unit impulse reponse 1 0 0 0
  • Result is the coefficients
  • Assume
  • bn 1/M for all n
  • Averaging filter

M8
M16
M24
6
Averaging Filter on Sinusoids
M8
M16
M24
7
FIR Implementation
  • Single-cycle (parallel) implementation

x(1)
8
FIR Implementation
  • Multi-cycle (and software) implementation

0 to M
counter
rst
addressable FIFO
x
out
X

coefficients
9
LMS Adaptive Filtering
GOAL Set the coefficients of F(x) to minimize
e(x)
d(n)
x(n)
S

-
y(n)
x(n)
GOAL Set the coefficients to minimize e(n)
FIR
e(n)
LMS
m can be fixed or normalized
10
MATLAB Example of LMS ANC
  • Load some speech and generate noise

load the signal signal load('RFrost.txt')
play it myplayer audioplayer(signal,10000) p
layblocking(myplayer) create noise white
noise gain .5 noise gain
randn(size(signal,1),1) sinusoid spacing F0
60 A 0.01 0.01 0.02 0.2 0.3 0.4 0.3 0.2 0.1
0.07 0.02 0.01 noise zeros(length(signal),1)
for k 1length(A) noise noise
(A(k)sin(2piF0k/10000(1length(signal))rand(
1)))' end create the "sound" sound signal
noise play the sound myplayer
audioplayer(sound,10000) playblocking(myplayer)
11
MATLAB Example of LMS ANC
  • Initialize the noise filter

set the filter parameters and initialize the
filter mu .2 taps 100 coef
zeros(1,taps) pad the noise noise
zeros(taps-1,1)noise error_out
out_signal
  • Train the noise filter

i taps while i lt size(noise,1) compute
filter output out fliplr(coef)noise(i-taps
1i,1) out_signal out_signalout
compute the error and record it error
sound(i-taps1,1) - out error_out
error_outerror update the step size and
coefficients with nLMS step_size mu /
(noise(i-taps1i,1)' noise(i-taps1i,1))
step_size mu coef coef step_size
fliplr(noise(i-taps1i,1)') error i i
1 end
12
MATLAB Example of LMS ANC
  • Play and plot

play and plot the errror myplayer
audioplayer(error_out,10000) playblocking(myplaye
r) n1length(signal) plot(n,sound',n,out_signal
',n,error_out') legend('signal
error','anti-noise','result')
13
Filtered-X LMS ANC
d(n)
x(n)
S

-
x(n)
y(n)
y(n)
actual secondary path filter
FIR
est. secondary path filter
e(n)
LMS
x(n)
14
MATLAB Example of Filtered-X ANC
  • Create the secondary path response

create the secondary path response delay is 7
samples delayS 10 N 100 order9, 200 Hz
to 2500 Hz, atten. in stop bands20 b,a
cheby2(9,20,200 2500/5000) extract impulse
response impulse zeros(1,delayS)
log(0.99rand(1,N-delayS)0.01) .
sign(randn(1,N-delayS)) . exp(-0.01(1N-delayS))
H filter(b,a,impulse) H H/norm(H)
  • Listen to the secondary path response

play the sound myplayer audioplayer(sound,1000
0) playblocking(myplayer) create and play
the sound received from the error
mic received_sound filter(H,1,sound) myplayer
audioplayer(received_sound,10000) playblocking(
myplayer)
15
MATLAB Example of Filtered-X ANC
  • Learn the secondary path response

learn the secondary path filter and filter the
received noise white_noise randn(1,30000) recei
ved_noise filter(H,1,white_noise) hadaptfilt.n
lms(250,.1,1,.1) yS,eS filter(h,white_noise,r
eceived_noise)
  • Filter X!

ref.
error
filter reference with 'our' filter this is
what implements filtered-x noise_filteredfilter(h
.coefficients,1,noise)
  • Initialize the noise filter

set the filter parameters and initialize the
filter mu .0001 taps 350 coef
zeros(1,taps) pad the noise noise
zeros(taps-1,1)noise noise_filtered
zeros(taps-1,1)noise_filtered error_out
error_filtered_out out_signal
zeros(length(H)-1,1)
16
MATLAB Example of Filtered-X ANC
  • Train the noise filter

i taps j length(H) while i lt
size(noise,1) compute filter output out
fliplr(coef)noise(i-taps1i,1)
out_signal out_signalout filter the
filter output out_filtered fliplr(H)
out_signal(j-length(H)1j,1) j j 1
compute the error and record it error
sound(i-taps1,1) - out_filtered error_out
error_outerror update the step size and
coefficients with nLMS step_size mu /
(noise_filtered(i-taps1i,1)'
noise_filtered(i-taps1i,1)) step_size
mu coef coef step_size
fliplr(noise_filtered(i-taps1i,1)') error
i i 1 debug if mod(i,2000) 0
coef end end
17
MATLAB Example of Filtered-X ANC
Write a Comment
User Comments (0)
About PowerShow.com