FUNCTION ngd() implements the operation of NGD algorithm INPUT: x: input signal which should be scaled according to the dynamic range of nonlinearity N: filter length mu: step-size OUTPUT: y: filter output Complex Valued Nonlinear Adaptive Filtering toolbox for MATLAB Supplementary to the book: "Complex Valued Nonlinear Adaptive Filters: Noncircularity, Widely Linear and Neural Models" by Danilo P. Mandic and Vanessa Su Lee Goh (c) Copyright Danilo P. Mandic 2009 http://www.commsp.ee.ic.ac.uk/~mandic %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You can obtain a copy of the GNU General Public License from http://www.gnu.org/copyleft/gpl.html or by writing to Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ...........................................
0001 % FUNCTION ngd() implements the operation of NGD algorithm 0002 % 0003 % INPUT: 0004 % x: input signal which should be scaled according to the dynamic range of nonlinearity 0005 % N: filter length 0006 % mu: step-size 0007 % 0008 % OUTPUT: 0009 % y: filter output 0010 % 0011 % 0012 % 0013 % Complex Valued Nonlinear Adaptive Filtering toolbox for MATLAB 0014 % Supplementary to the book: 0015 % 0016 % "Complex Valued Nonlinear Adaptive Filters: Noncircularity, Widely Linear and Neural Models" 0017 % by Danilo P. Mandic and Vanessa Su Lee Goh 0018 % 0019 % (c) Copyright Danilo P. Mandic 2009 0020 % http://www.commsp.ee.ic.ac.uk/~mandic 0021 % 0022 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0023 % This program is free software; you can redistribute it and/or modify 0024 % it under the terms of the GNU General Public License as published by 0025 % the Free Software Foundation; either version 2 of the License, or 0026 % (at your option) any later version. 0027 % 0028 % This program is distributed in the hope that it will be useful, 0029 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0030 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0031 % GNU General Public License for more details. 0032 % 0033 % You can obtain a copy of the GNU General Public License from 0034 % http://www.gnu.org/copyleft/gpl.html or by writing to 0035 % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. 0036 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0037 % ........................................... 0038 function y = ngd(x,N,mu) 0039 0040 M = 1;% prediction horizon 0041 L = length(x)-M; % run length 0042 filterinput = zeros(N,L); 0043 WNGD = zeros(N,1); % weight vector 0044 eNGD = zeros(1,L); % error 0045 filteroutput = zeros(1,L); 0046 output = zeros(1,L); 0047 0048 for i = 1:L 0049 for m = 1:N 0050 if (i-m+1)>0 0051 filterinput(m,i) = x(1,i-m+1); 0052 else 0053 filterinput(m,i) = 0; 0054 end 0055 end % inputing FIR 0056 filteroutput(i) = transpose(filterinput(:,i)) * WNGD;% output of FIR filter 0057 output(i) = f(filteroutput(i)); 0058 eNGD(i) = x(i+M) - output(i);% error(k) of nonlinear FIR filter 0059 WNGD = WNGD + mu * eNGD(i) * conj(fderive(filteroutput(i))) * conj(filterinput(:,i));% weight update 0060 end 0061 y = output; 0062 0063