^{®} using DSP System Toolbox™. Use non-tunable filters when the filter response is known and fixed during simulation. On the other hand, tunable filters allow modification of block parameters and filter coefficients during model simulation varying the filter response as needed.

Digital filters are central to many signal processing systems and are used to suppress, or eliminate unwanted artifacts from signals to enhance their quality. When deciding how to design and implement a filter, there are a range of factors to consider, including frequency and phase responses, differing typologies, impulse response behaviors, implementation costs, and degrees of tuned ability. In Simulink the DSP system toolbox block library, includes blocks supporting an extensive range of filter design and implementation algorithms.

In this video, we'll provide an overview of these filter blocks to aid in the process of selecting appropriate filter types given a set of system requirements. Specifically, we'll focus on categorizing the filter blocks based on their tunability at runtime. Tunable simulating blocks can have their block parameters modified during a simulation, removing the need to update the model diagram between runs, and speeding up testing.

Shown here, the block parameters of a backward filter block are tuned during runtime, to filter a chirp signal with a varying frequency. DSP system toolbox filter blocks can be broadly classified as having finite duration, or infinite duration impulse responses. FIR or IIR for short. Within each of these groups there are several options for tunable and non tunable filters.

To start, let's examine the non tunable filters of each group. Nontunable filter blocks independently filter each channel of the input signal over time using the filter design specified by their block parameters, as they are non tunable their block parameters and filter response cannot be changed during runtime. The set of non tunable filter blocks shown here is located in the DSP system toolbox block library under filtering filter designs.

As we can see, there are many additional non tunable filter designed blocks available in the block library. Taking a closer look at low pass filter block as an example, we can see the options to modify block parameters for filter type, pass band edge frequency, stop band edge frequency, and more. With the filter type parameter, you can control whether the block implements in IIR or FIR filter.

Next, let's investigate the subset of filter blocks, that are tunable at runtime. The variable bandwidth FIR and variable bandwidth IIR blocks are for tunable filter implementations for lowpass, highpass, band pass, and band stop filters. Both blocks enable you to tune certain parameters during simulation without having to redesign the entire filter. Each blocks filter algorithm recomputes the filter coefficients whenever tunable parameter is modified.

Let's take a closer look at the variable bandwidth FIR block. With the filter type setup and pass, for example, the filter center frequency and bandwidth parameters are tunable during runtime. Note that this blocks tunable parameters can be edited directly from the dialog box is shown here, or via input ports to the block itself by checking this option. Selecting input ports, adds additional input ports to the filter block.

To exert even greater control over the tunability of filters in your signal processing system, consider implementing the discrete FIR filter or backward filter blocks. Both blocks allow filter coefficients to be tuned during simulation. Taking the backward filter block as an example, we can note the option to provide a filter coefficient values from input ports, dialogue parameters, or system filter object defined in the base Matlab workspace.

Now, let's review the differing applications of the filter blocks we've covered with an example involving noise removal. To start, let's consider the case of a single frequency signal with added random noise. The primary signal has a frequency of six kilohertz, and is sampled at a rate of 44.1 kilohertz. Random noise is added across the range of sampled frequencies.

In order to isolate the main signal an IRS band pass filter block is added, and its output is compared to the original signal with a spectrum analyzer. The band pass filter block is implemented with an IIR impulse response, and the stop band and pass band frequencies shown here. Let's click View filter response to launch the filter visualization tool for this set of filter parameters. With this tool, we can analyze the filters magnitude and phase responses, impulse response, and pull zero plot amongst other filter characteristics.

Let's run the simulation to view the filter's effective. Comparing the power spectra of the original unfiltered signals, we can see that the band pass filter maintains the power of the primary signal, and attenuates noise located outside of the specified bandwidth. The non-tunable band pass filter block works well for this scenario, as we knew the frequency characteristics of the signal to isolate before starting the simulation.

Now, let's consider a second case where the frequency of the signal to be filtered is changing over time. In this case, the sine wave block has been replaced with a chirp block set to output a linear sweep of signal frequencies from 5 to eight kilohertz, the sample rate of 44.1 kilohertz. The same source of random noise is added to the chirp signal. To effectively reduce the noise from the chirp signal, we've implemented a tunable band pass filter in the form of a variable bandwidth IIR block.

We've set the center frequency of the band pass filter to be specified from an input port, Instead of fixed filter bandwidth of 1.25 kilohertz. Setting the cutoff frequency Fc to be specified by the input port, causes it to become a tunable parameter that can be modified during simulation. To calculate the center frequency for the band pass filter at each time step, we've included a matlab function block to incorporate a portion of matlab code in the simulation model. This block contains a script designed to output the frequency associated with the maximum value of the signals power spectrum at each time set. The p welch function, is used to calculate the input signals power spectrum. In the index of the maximum value is used to output the frequency of the desired signal.

Let's run the simulation to view the tunable filter in action. As we can see the center frequency of the variable bandwidth IIR block closely follows the frequency of the desired signal during simulation. Comparing the original signal to the filtered signal across the range of sample frequencies, we can note that the filtered signals, signal to noise ratio of about 60 DVC is greater than the original signal to noise ratio of about 45 DVC signifying noise reduction.

Finally, let's consider how a tunable filter whose design is instead specified by coefficient values could be implemented to achieve a similar response. In this third case, will employ a tunable backward filter block driven by numerator and denominator coefficients to act as a band pass filter to reduce noise from the same gerb signal in the last example. Inspecting the backward filter further we can note the coefficient sources is set to input ports allowing the numerator and denominator filter coefficients to be tunable at runtime.

Once more, a matlab function block is included. This time to calculate the tunable filter block parameters at each time step. After determining the center frequency for the band pass filter with p welch as before, the design program EQ function is used to compute the numerator and denominator coefficients of the band pass filter. The filter design function accepts multiple inputs for gain, center frequency, and bandwidth, which we've defined above. Let's run the simulation to see the effect of the backward filter.

As we can see from the spectrum analyzer. The background filter block is dynamically tuned with filter coefficients, redesigning the filter at each time step to effectively track and filter the desired signal. Looking once more to the signal to noise ratios, we can note that the filtered signals SNR value of about 90 DVC is much greater than the original signal's value of about 45 DVC, a sign of reduced noise.

To summarize, DSP system toolbox supports a range of tunable and tunable filter designs for both FIR and IIR filters. If you know beforehand that your filters response will be unchanging at runtime, the non tunable filter designed blocks can be used to design and implement FIR and IIR filters. On the other hand, the variable bandwidth FIR and IIR filters discrete FIR filter, and backward filter blocks can be used to tune filter responses at runtime via filter parameters and coefficients. For more information and examples related to designing and implementing filters with DSP system toolbox, please visit our documentation.

Featured Product

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

- América Latina (Español)
- Canada (English)
- United States (English)

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)

- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)