"Adaptive Noise Cancellation Using The Adaptive Neuro-Fuzzy Inference System Algorithm" Yassir A. Granillo April 20, 2006 EE 5390: Fuzzy Logic and Engineering Professor: Dr. Thompson Sarkodie-Gyan
"Adaptive Noise Cancellation Using The Adaptive Neuro-Fuzzy Inference System Algorithm" Yassir A. Granillo April 20, 2006 EE 5390: Fuzzy Logic and Engineering Professor: Dr. Thompson Sarkodie-Gyan
Granillo April 20, 2006 EE 5390: Fuzzy Logic and Engineering Professor: Dr. Thompson Sarkodie-Gyan
Abstract The main goal of this project is to cancel the noise generated in the signal and produce an output with as little as noise as possible. The concepts used in this project will be dealt with in Signal-to-Noise Ratio, or SNR. This means how much signal there is compared to the noise generated. Of course the higher the SNR the better but that is not always the case. To implement this process of noise cancellation, the software that will be used is MATLAB 7.0 with the help of the Fuzzy Logic Toolbox, using a very advanced algorithm called the adaptive neuro-fuzzy inference system better known as the command anfis. Introduction In electronic systems, the one parameter that can not be eliminated completely is called noise. To be more technical, noise is any unwanted signal at any frequency that accompanies the desired signal and tends to contaminate it. Noise limits measurement, precision, and signal detectability. These noises are infiltrated in the system by internal and external means. External noise is any noise due to the environment, such as power frequency interference, auto ignition, radio and television, lighting, and structure vibration. Some of this noise is also generated internally, as in resistors, diodes, and amplifiers, electronic systems and equipment. Methods of adaptive noise cancellation were proposed by Widrow and Glover in 1975. The methods were applied successfully in the areas of image processing and communications [1], [2]. The main objective of adaptive noise cancellation is to filter out an interference parameter. This is done by identifying a model between a measurable noise source and the corresponding non-measurable interferences. In many and in fact in most situations, a linear model operates exceptionally. But nevertheless, a linear model does not perform well in situations that nonlinear phenomena occur [3]. This is the main reason why the need for adaptive nonlinear filtering is approached. Experimental Procedure The very first step for this project was the generation of a sinusoidal wave, which is the information signal of the system using MATLAB 7.0. A sinusoidal was used because it is a continuous function with infinite energy that is very common in all electronic applications, such as an AC source signal, whether it is a current or a voltage source, a heart monitor, radiated electromagnetic and sound waves, and many other forms. The creation of the sinusoidal was rather simple; no complex parameters were added to the sinusoidal. The sinusoidal was defined from time zero seconds (0) all the way to time ten (10) seconds with an increment of 0.01 seconds. Proceeding the generation of the sinusoidal, a noise source signal had to be implemented because the information signal can not be measured without an interference signal. The reason is stated in the introduction; because the main goal of adaptive noise cancellation is to filter out an interference parameter. Hence the implementation of the interference signal is necessary. A perfect example of this is the apparatus of the heart monitor. The heart monitor reads the activity of the heart, but there are interferences inside the human body that can not make the reading of the heart precise; but with the help of the adaptive noise cancellation, interferences from outside source can be dealt with and thus the desired reading of the human heart activity is made possible. This noise source signal is generated by the function randn which produces a random signal of size t, where t is the range of the information signal spread out over a
certain amount of defined time. The command randn produces an unknown nonlinear function system. Once the noise source signal is generated, an interference signal is produced via an unknown nonlinear equation. Meaning that the interference signal comes from the noise signal and this interference signal is necessary to measure the information signal. After the results of the information signal, the noise source signal, and the interference signal were acquired, the user proceeded to graphing the noise source signal, the noise source signal with a delay of one (1), and the interference signal by using the command surf in MATLAB, which allowed the user to plot these three functions in a three-dimensional graph. The creation of the 3-D graph allows the user to visualize the interference and noise in open space. The generation of the surf leads the user to an important and crucial step in the project, the construction of the interference signal from the noise source signal. Again the user needs this in order to measure the information signal versus the interference signal. A comparison of the interference and the noise source signal is made. Following the comparison of the interference and the noise source signal, the next step was to output the measured signal, m, of the system. The method used in this process was to simply add the interference of the signal to the information signal. There is one drawback though, the user still does not have the function n2, the interference of the signal. However, the user does know this, x, the information signal, and n1, the noise source signal. The job of the user is to recover the original signal from the measured signal, the sum of n2 and m. The next part of this project is to fuzzify the signal in order to recover the original signal. To do this the command anfis is used to identify the nonlinear relationship between n1 and n2. Although n2 is not directly known to the user, the user shall take the measured signal, m, as a contaminated version of n2 for training and thus x is treated as noise in this kind of nonlinear fitting. Here the user assumes the order of the nonlinear channel is known (in this case, 2), so we can use 2-input anfis for training. The user assigns two membership functions to each input, so the total number of fuzzy rules for learning is 4. Also the user sets the step size equal to 0.2. The command evalfis was also used. This command is used to perform fuzzy inference calculations. Also, the command of genfis1 is used to generate a fuzzy inferences system structure from data without data clustering. The estimated interference signal is fuzzified in order to generate the estimated information signal, e_x . This again is estimated by subtracting the estimated interference signal from the measured signal, m. The final step in this project was to recover the original signal from defuzzification. First, it is established that the estimated information signal x is equal to the difference between the measured signal m and the estimated interference (that is, ANFIS output). The original information signal x and the estimated x by ANFIS are plotted. Data Acquisition (Crisp) The crisp values acquired for this project were the information signal, x, the noise source signal, n1, the interference signal, n2, the measured signal, m, and the threedimensional representation of the interference signal plotted against the noise source
signal and the interference signal. To generate the hypothetical information signal, the user implemented in MALTAB a sinusoidal wave. The code for looks as follows: t = (0:0.01:10)'; x = sin(4*2*pi*t); plot(t,x); title('Information Signal x'); xlabel('TIME'); ylabel('GAIN');
Fig. 1: A hypothetical information signal x sampled at 100Hz over 10 seconds. The next data acquired for project was the noise source signal. Again the noise source signal is needed in order to generate the interference signal. The code for the generation of the noise source signal, n1, is as follows: n1 = randn(size(t)); plot(t, n1); title('Noise Source Signal'); xlabel('TIME'); ylabel('Noise');
Fig.2: Random Noise Source Signal Next, the three-dimensional plot is shown. This plot shows the behavior of the interference signal n2 that appears in the measured signal is assumed to be generated via an unknown nonlinear equation: n2 = cos(n1) (Eq.1)
The code for the 3-D plot is as follows: d = linspace(min(n1), max(n1), 20); [xx, yy] = meshgrid(d, d); zz = 4*cos(xx); surf(xx, yy, zz); xlabel('Noise 1'); ylabel('No Affect'); zlabel('Interference Signal'); title('Unknown Parameters That Generate Interference'); axis([min(d) max(d) min(d) max(d) min(zz(:)) max(zz(:))]); set(gca, 'box', 'on');
Fig.3: Nonlinear characteristic of the system. The command meshgrid allows for the X and Y arrays to generate 3-D plots. The command linspace generates linearly spaced vectors. Proceeding to the next crisp value, the interference signal was generated via the noise source signal. The user assumed a nonlinear equation for the interference such as Eq.1. Henceforth, the code for the interference signal is described below: n2 = cos(n1); a = [min(t) max(t) min([n1;n2]) max([n1;n2])]; plot(t, n2); xlabel('TIME); ylabel('Interference'); title(' Interference Signal');
Fig.4:Interference Signal with nonlinear characteristics. The last set of crisp values was the graph generated by the measured value. The measured signal m is the sum of the original information signal x and the interference n2.
However, the user does not know n2. The only signals available to the user are the noise signal n1 and the measured signal m, and the users task is to recover the original information signal x. The code for this signal is described below: m = x + n2; plot(t, m) title('Measured Signal'); xlabel('TIME');
Fig. 5: The measured signal composed of the information and interference signals. Fuzzification and Rule-Based System The fuzzification of the project dealt with the commands evalfis, genfis1, and anfis. The first part of the project that was fuzzified was the delayed signal of the noise source signal, the measured signal, and the noise source signal. These three functions were put into a matrix together before they were fuzzified. The user calls the matrix in which the delayed noise source signal, the noise source signal, and the measured signal a training data matrix. This occurs since n2 is not directly available to the user, a corrupted version of n2 is taken from the measured signal, m. Before fuzzifying the training data matrix, the user needs to determine the number of membership functions that will be used in this project. For this particular example, the user decided to use two membership functions because of the order of the nonlinear channel (the 3-D plot). After having decided the number of membership functions to be used in this project, the number of rules are now determined. Because of the command anfis the assignment of two membership functions to each input is assigned. Since the users order of the nonlinear channel is 2, the user also assumes two (2) inputs to the system. Because of the number of inputs the user has and because of the number of membership functions the user has, the quantity of rules used in this project is four rules (4). Finally, the step size of the system is 0.2. Having defined these parameters, the user is now ready to fuzzify the functions. After having put n1_1, the delayed noise source signal, n1, the noise source signal, and m, the measured signal, into a training data matrix, the
assembled training data matrix is not the input to the fuzzy inference system (FIS) with two membership functions. The fuzzification looks as follows: d_n1 = [0; n1(1:length(n1)-1)]; training = [d_n1 n1 m]; mf = 2; ss = 0.2; in=genfis1(training, mf); The command genfis1 is used to fuzzify the training data matrix. GENFIS1 generates a Sugeno-type FIS structure used as initial conditions (initialization of the membership function parameters) for anfis training. GENFIS1 (data, number of membership functions, in membership function type, out membership function type) generates a FIS structure from a training data set, using a grid partition on the data (no clustering). The next step was to fuzzify the output of the system. This was done by the command anfis. ANFIS uses a hybrid learning algorithm to identify parameters of Sugeno-type fuzzy inference systems. It applies a combination of the least-squares method and the back-propagation gradient descent method for training FIS membership function parameters to emulate a given training data set [3]. The code implemented for this project using anfis goes as follows: Out=anfis(training, in, [nan nan ss]); The final step that the user took was to evaluate the fuzzy inference system using the command evalfis. This function was used to get the estimated interference signal by using the training data and the fuzzification of the output. The code for this process is: e_n2 = evalfis(training(:, 1:2), out); Finally, in order to get the recovered signal, the user subtracted e_n2, the estimated interference signal, from the measured signal, m. e_x=m - e_n2; Defuzzification The advanced algorithms used in this project such as anfis and genfis1 have their own defuzzification method. Since in this project involves Sugeno-Type Fuzzy Inference Systems, the defuzzification method used in this project is weighted average process. This defuzzification model involves for both commands genfis1 and anfis. In weighted average defuzzification method, the output is obtained by the weighted average of the each output of the set of rules stored in the knowledge base of the system. The weighted average defuzzification technique can be expressed as
x* = m i wi /( m i )
i =1 i =1 n n
(Eq. 2)
where x* is the defuzzified output, mi is the membership of the output of each rule, and wi is the weight associated with each rule [4]. Results The results for this project were rather astounding. First at the fuzzification process, the graph of the estimated interference signal was generated with the command evalfis. The code for the generated estimated interference signal looks as follows: a1 = [min(t) max(t) min([n2; e_n2]) max([n2; e_n2])]; plot(t, e_n2);
Fig. 6: Estimated Interference Signal using evalfis Now comes the real part of the project, the actual reconstruction of the original information signal, in this case called the estimated information signal, e_x. The estimated information signal, x, is equivalent to the difference between the measured signal, m, and the estimated interference signal, which is the output of the adaptive neuro-fuzzy inference system. The original information signal x and the estimated x by anfis are plotted. The code looks the following way: a2= [min(t) max(t) min([x; e_x]) max([x; e_x])]; plot(t, e_x); title(Reconstructed Information Signal); xlabel(TIME); ylabel(Estimated Information Signal);
Finally, the user compares the graph of the original information signal to that of the reconstructed information signal.
Fig 8: The top graph represents the original signal and the bottom graph represents the reconstructed signal. Conclusion and Recommendation for Future Enhancement Fuzzy logic is an excellent way to implement signal reconstruction process. The algorithm anfis is a very practical and very proficient function that can do the job; and the beauty of this algorithm, it works with nonlinear processes. The good thing about this algorithm also is that it can do the job also without having to implement a training data matrix. The anfis algorithm helps better the signal-to-noise ratio in electronic apparatus such as the heart monitor discussed previously. The less noise the electronic system has, the better it is; hence the anfis helps in systems cancel unwanted signal such as noise using fuzzy logic. A group of Asian graduates from Singapore made a similar approach to the project just presented, it is called Adaptive Noise Cancellation Using Enhanced Dynamic Fuzzy Neural Networks, and this article was published in the IEEE journal. The group was composed of three graduate students and a professor from the University of Singapore. They conducted very extensive research and came up with an interesting algorithm, called the Modified Dynamic Fuzzy Neural Networks (mdfnn). They compared the mdfnn algorithm with the anfis algorithm. These graphs are their testing results:
Fig. 9: The top part is a test simulation with ANFIS and the bottom with MDFNN. Notice that the bottom signal has much less noise than the top graph. In the users opinion, the signal is cleaner and more precise to the original function. This is algorithm is by far better that the command anfis and gives better representation of the original information signal. This algorithm is an enhancement of the anfis command.
References Cited
[1] B. Widrow and J. R. Glover, Adaptive noise canceling: Principles and applications, Proc. IEEE, vol. 63, no. 12, pp. 16921716, 1975. [2] B. Widrow and J. R. Glover, Adaptive Signal Processing. Upper Saddle River, NJ: Prentice-Hall, 1985. [3] Meng Joo Er, and Zhengrong Li, Adaptive noise canceling: Principles and applications, Proc. IEEE, vol. 63, no. 12, pp. 16921716, 1975. [4] T. J. Ross, Fuzzy Logic with Engineering Applications, McGraw-Hill, Inc, 1995.