Matlab Simulink Active Noise Reduction
![](https://wiredwhite.com/wp-content/uploads/2022/11/simulink_model-1024x473.jpg)
The given article gives a short illustration of how a Matlab Simulink Active Noise Reduction task was easily and successfully implemented.
Firstly, in this simulation a signal is created by summing the actual and the filtered version of it through an FIR having taps as b. This composite signal is a reference and the goal is to nullify the noise using LMS algorithm.
The Matlab function is based on the Least Mean Square algorithm. The gradient size is kept at 0.01 in this case. The gradient size is usually kept small enough so that the residual after convergence remains small enough. However, the lower gradient values require more time for convergence.
The output of the function is subtracted from the composite signal and the results are gathered. These are explained in detail in the following text.
Test point 1
Signal at the out port 1 of the Matlab function block is shown. This depicts that the signal generated has a peak voltage around <3.0V. A difference of signal from both sources (Level 2 function and converter Matlab function) is presented and found to be in the order of 1e-15. This signal is small enough and even goes out of the resolution of 32 bits. The quantization error for such a signal requires 50 bits at least. Thus, making this error insignificant.
![](https://wiredwhite.com/wp-content/uploads/2022/11/simulink_model-1024x473.jpg)
![](https://wiredwhite.com/wp-content/uploads/2022/11/results_comparison_1-1024x603.jpg)
Similarly for the port 2 of the Matlab function, block error is plotted and the results of the converted block are found in conformance with the actual level-2 function. The error between the two signals is in the order of 1e-15 and can be ignored in actual implementation.
![](https://wiredwhite.com/wp-content/uploads/2022/11/matlab_simulink_converted-1024x473.jpg)
![](https://wiredwhite.com/wp-content/uploads/2022/11/results_comparison_2-1024x603.jpg)
The signal is captured after the subtraction of the actual noise and the generated signal from the LMS Matlab function. The subtraction block reduces the magnitude of the error from 1.5 to 0.2 gradually, which is around 7 time reduction. This much reduction corresponds to around ~17dB which certainly is quite a significant value.
![](https://wiredwhite.com/wp-content/uploads/2022/11/results_comparison_3-1024x603.jpg)
Algorithm
The algorithm is a least mean algorithm where new taps are generated based on the last error. For this purpose, the algo is best defined by this equation.
%% H^(n+1)[i] = H^(n)[i]+mu*(d(n)-y(n))*u(n-i)
where
u is the input
y is the output
mu is the step size of gradient
H(n) are current taps
H(n+1) are the new taps
Taps are updated with each run and are converged to cancel the noise source.
Conclusion
In sum, the converted code is good to be used as stand alone in Matlab script, or even can be used to generate the C/C++ code for embedded applications, over micro controller and DSPs.
Need help solving similar Matlab Simulink Active Noise Reduction problems? Just reach out to one of our engineering tutors here.
Responses