Adaptive Filter Design
Adaptive Filter Design
On
Adaptive Filters- Implementation and
Applications
BY:
ADITYA MANGLIK 2014A3PS296P
RISHABH BHARDWAJ 2014A3PS179P
AT
Often, the (average) square value of the error signal is used as the
optimization criterion. The aim is to adapt the digital filter such that the
input signal is filtered to produce output which when subtracted from
desired signal, will minimize the power of the error signal. Hence,
adaptive filters are also called as self-learning filters, whereby an FIR (or
IIR) is designed based on the characteristics of the input signals.
2. ADAPTIVE FILTER
An adaptive filter is a device dedicated to model the relationship between
two signals in real time in a computationally iterative manner. Adaptive
filters are often realized either as a set of program instructions running on
a processing device such as a specific Digital Signal Processing
chip(ASIC), or as a set of logic operations implemented in a field-
programmable gate array (FPGA).
For this project, we shall focus on the mathematical forms of adaptive
filters as opposed to their specific realizations in software or hardware.
2. The structure that defines how the output signal of the filter is
computed from its input signal.
d(n) - y(n)
Adaptive y(n)
Filter
(System)w
Unknown d(n)
x[n] System e(n)
(Filter)h
Figure 1.1
If the unknown system is time invariant, i.e. the coefficients of its
impulse response are constants and of finite extent (FIR). So we write
d(n) = ∑𝑛−1
𝑘=0 hk x(n − k) (1)
The output of an adaptive FIR filter with the same number of coefficients
N, is given by
𝑘=0 ωk x(n − k)
y(n) = ∑𝑛−1 (2)
For these two systems to be equal, the error or difference e(n) = d(n) –
y(n) must be equal to zero. The condition in which two sets of coefficients
are equal. It is the method of adaptive filtering that will enable us to
produce an error, e(n), approximately equal to zero.
2.1. Filtering Random Process
{x(0),x(1),x(2),…}
This is also called a time series if the random variable is continuous at any
time.
𝑞
∑ b(k)z−k
𝐵(𝑧) 𝑘=0
𝐻(z) = 𝑝 (3)
𝐴(𝑧) 1+∑
𝑘=0
b(k)z−k
If a white noise, v(n), with variance 𝜎𝑣2 is the input to the above filter,
the output process x(n) is a WSS process and its power spectrum is given
by
2 𝐵(𝑧)𝐵(𝑧 −1 )
𝑆𝑥 (𝑧) = 𝜎𝑣 ( ) ( −1 ) (4)
𝐴 𝑧 𝐴 𝑍
A special and important type of ARMA process results when set q=0
called Autoregressive process (AR).
2.3. LMS (Least Mean Squares) Algorithm
Most popular adaptation algorithm is LMS. Define cost function as mean
– square error. The algorithm is based on the method of steepest descent
method. Moving towards the minimum on the error surface to get to
minimum gradient of the error surface estimated at every iteration.
(8)
Simple, no matrices calculation involved in the adaptation and in the
family of stochastic gradient algorithms. The algorithm is based in
the minimum mean square criterion (MMSE). Adaptive process
containing two input signals: a) Filtering process, producing output
signal. b) Desired signal (Training sequence).
2) Estimation error :
e(n) = d(n) – y(n) (8)
3) Tap-weight adaptation:
High
Low
Low
LMS is sensitive to scaling of its input. So, NLMS comes into the
picture to solve the problem.
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Outputs from this function are returned to the command line.
function varargout = DSP_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
switch val
case 1 %User selects Data File
[FileName,~] = uigetfile('*.txt','Select the data file');
handles.input_type=1;
data=importdata(FileName);
handles.input_data=data;
end
% Update handles structure
guidata(hObject, handles);
switch val
case 1
handles.filter_type=1;
case 2
handles.filter_type=2;
case 3
handles.filter_type=3;
case 4
handles.filter_type=4;
case 5
handles.filter_type=5;
end
% Update handles structure
guidata(hObject, handles);
switch handles.filter_type
case 1 %LMS
handles.output_data=DSPFilterLMS(handles.desired_data,handles.input_data,handles.order,ha
ndles.mu);
case 2 %NLMS
handles.output_data=DSPFiletrNLMS(handles.desired_data,handles.input_data,handles.order,h
andles.mu);
case 3 %XLMS
handles.output_data=DSPFilterXLMS(handles.desired_data,handles.input_data,handles.order,h
andles.mu);
case 4 %RLS
handles.output_data=DSPFilterRLS(handles.desired_data,handles.input_data);
case 5 %Affine
handles.output_data=DSPFilterAffineProjection(handles.desired_data,handles.input_data,han
dles.order,handles.mu);
end
% Update handles structure
guidata(hObject, handles);
case 3 %XLMS
switch handles.input_type
case 1
figure
plot(abs(fft(handles.output_data)));
case 2
sound(handles.output_data,handles.Fs);
end
case 4 %RLS
switch handles.input_type
case 1
figure
plot(abs(fft(handles.output_data)));
case 2
sound(handles.output_data,handles.Fs);
end
case 5 %Affine
switch handles.input_type
case 1
figure
plot(abs(fft(handles.output_data)));
case 2
sound(handles.output_data,handles.Fs);
end
end
% Update handles structure
guidata(hObject, handles);
switch handles.input_type
case 1 %User selects Data File
msgbox('Input signal is plotted in Axis 1');
case 2 %User selects Audio File
sound(handles.input_data,handles.Fs);
%% END