Sunteți pe pagina 1din 7

11/8/2014

DIGITAL SIGNAL
PROCESSING
ASSIGNMENT II: ADAPTIVE FILTERING

Ranjeet Kumar (EDS14M011)


IIITDM KANCHEEPURAM

ADAPTIVE FILTERING
An adaptive filter is a system with a linear filter that has a transfer function controlled by variable
parameters and a means to adjust those parameters according to an optimization algorithm.
Because of the complexity of the optimization algorithms, most adaptive filters are digital filters.
Adaptive filters are required for some applications because some parameters of the desired
processing operation (for instance, the locations of reflective surfaces in a reverberant space) are
not known in advance or are changing. The closed loop adaptive filter uses feedback in the form of
an error signal to refine its transfer function.
Adaptive filters are broadly used for applications such as
(I)System Identification
(II) Inverse Modelling
(III)Interference Cancellation
(IV)Prediction
Widely used adaptive filtering algorithms are LMS (Least Mean Square) , RLS (Recursive least
square),Wiener Filter ,Kalman Filter etc

LMS Algorithm
Step 1: Filter output
yn

M 1

un k w n
k 0

*
k

Step 2: Estimation error


en d n yn
Step 3: Tap-weight adaptation
wk n 1 wk n un k e* n

Example 1.Adaptive filtering for ANC (Active Noise Cancellation)


using LMS algorithm
Used to cancel unknown interference from a primary signal

Parameters:
u=input of adaptive filter=reference signal
y=output of adaptive filter
d=desired response=primary signal
e=d-y=estimation error=system output

MATLAB Code
close all;
clear all;
clc;
t=1:0.025:5;
desired=5*sin(2*3.*t);
noise=5*sin(2*50*3.*t);
refer=5*sin(2*50*3.*t+ 3/20);
primary=desired+noise;
subplot(4,1,1);
plot(t,desired);
ylabel('desired');

subplot(4,1,2);
plot(t,refer);
ylabel('refer');

subplot(4,1,3);
plot(t,primary);
ylabel('primary');

order=2;
mu=0.005;
n=length(primary)
delayed=zeros(1,order);
adap=zeros(1,order);
cancelled=zeros(1,n);
for k=1:n,
delayed(1)=refer(k);
y=delayed*adap';
cancelled(k)=primary(k)-y;
adap = adap + 2*mu*cancelled(k) .* delayed;
delayed(2:order)=delayed(1:order-1);
end

subplot(4,1,4);
plot(t,cancelled);
ylabel('cancelled');

Output Window:

Example 2: System Identification using LMS Algorithm

Parameters:
u=input of adaptive filter=input to plant
y=output of adaptive filter
d=desired response=output of plant
e=d-y=estimation error

MATLAB CODE:
clc;
close all;
clear all;
x = randn(1,500);
% Input to the filter
b = fir1(31,0.5);
% FIR system to be identified
n = 0.1*randn(1,500); % Observation noise signal
d = filter(b,1,x)+n; % Desired signal
mu = 0.008;
% LMS step size.
ha = adaptfilt.lms(32,mu);
[y,e] = filter(ha,x,d);
subplot(2,1,1); plot(1:500,[d;y;e]);
title('System Identification of an FIR Filter');
legend('Desired','Output','Error');
xlabel('Time Index'); ylabel('Signal Value');
subplot(2,1,2); stem([b.',ha.coefficients.']);
legend('Actual','Estimated');
xlabel('Coefficient #'); ylabel('Coefficient Value');
grid on;

Output Window:

S-ar putea să vă placă și