DSP Blockset Previous page   Next Page

Creating an Adaptive Filter

In the previous topic, Creating an Acoustic Environment, you created a system that produced two output signals. The signal output at the Exterior Mic port is composed of white noise. The signal output at the Pilot's Mic port is composed of colored noise added to a signal from a .wav file. In this topic, you create an adaptive filter to remove the noise from the Pilot's Mic signal. This topic assumes that you are working on a Windows operating system and have completed the procedures described in Creating an Acoustic Environment:

  1. From the Adaptive Filters library, click-and-drag an LMS Filter block into the model that contains the Acoustic Environment subsystem.
  2. Double-click the LMS Filter block.

  1. The Block Parameters: LMS Filter dialog box opens.

  1. From the Algorithm list, select Normalized LMS.

  1. The block uses the normalized LMS algorithm to calculate the filter coefficients.

  1. For the Filter length parameter, enter 40 to specify an adaptive filter with forty coefficients.
  2. For the Step-size (mu) parameter, enter 0.002.
  3. For the Leakage factor (0 to 1) parameter, enter 1.

  1. Setting the Leakage factor (0 to 1) parameter to 1 means that the current filter coefficient values depend on the filter's initial conditions and all of the previous input values.

  1. Click OK.
  2. Click-and-drag the following blocks into your model.

    Block
    Library
    Quantity
    Constant
    Simulink/Sources
    2
    Manual Switch
    Simulink/Signal Routing
    1
    Terminator
    Simulink/Sinks
    1
    To Wave Device
    Platform Specific I/O/ Windows
    1
    Downsample
    Signal Operations
    1
    Waterfall Scope
    DSP Sinks
    1
  3. Connect the blocks so that your model resembles the following figure.

  4. Double-click the Constant block.
  5. Set the Constant value parameter to 0
  6. Click OK.
  7. Double-click the To Wave Device block and set the parameters as follows.

  1. Click OK.

  1. Double-click the Downsample block. Set the parameters as shown in the following figure.

  1. The filter weights are being updated so often that there is very little change from one update to the next. To see a more noticeable change, you need to downsample the output from the Wts port.

  1. Click OK.
  2. Double-click the Waterfall Scope block. The Waterfall scope window opens.
  3. Click on the Scope parameters button.

  1. The Parameters window opens.

  1. Click on the Axes tab. For the Y Min parameter, enter -0.188. For the Y Max parameter, enter 0.179.
  2. Click on the Data history tab. For the History traces parameter, enter 50. From the Data logging list, choose All visible.
  3. Close the Parameters window leaving all other parameters at their default values.

  1. You might need to adjust the axes in the Waterfall scope window in order to view the plots.

  1. Click on the Fit to view button in the Waterfall scope window.
  2. Then click-and-drag the axes until they resemble the following figure.

  3. In the model window, from the Simulation menu, select Simulation parameters.

  1. The Simulation parameters dialog box opens.

  1. Click on the Solver tab.
  2. Set the Stop time to inf.
  3. From the Type list, select Fixed-step and discrete (no continuous states).
  4. Click OK.
  5. Run the simulation and view the results in the Waterfall scope window. You can also listen to the simulation using the speakers attached to your computer.
  6. Experiment with changing the Manual Switch so that the input to the Acoustic Environment subsystem is either 0 or 1.

  1. When the value is 0, the Gaussian noise in the signal is being filtered by a lowpass filter. When the value is 1, the noise is being filtered by a bandpass filter. The adaptive filter can remove the noise in both cases.

You have now created a model capable of adaptive noise cancellation. The adaptive filter in your model is able to filter out both low frequency noise and noise within a frequency range. In the following topic, Customizing an Adaptive Filter, you modify the LMS Filter block and change its parameters during simulation.


Previous page  Creating an Acoustic Environment Customizing an Adaptive Filter Next page

Learn more about the latest releases of MathWorks products:

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS