MATLAB Fdatool IIR Digital filter Design __matlab

Source: Internet
Author: User

Design of MATLAB IIR digital filter

First we need to understand the relevant concepts.

Digital filter design uses angular frequency, how to correspond with the actual signal frequency.

Angular frequency w, sampling frequency FS, the actual signal frequency F conversion relationship is:

W = 2*pi* f/fs

the angular frequency of the sampling frequency is 2 *pi.

the index of digital filter, take the low pass as example "see the following diagram":

  

When we design the filter is a band-pass time. The cut-off frequency of the band is two, and the cut-off frequency of the band is two. The cut-off frequency also has another title, namely the edge frequency.

FIR filters can be designed to be linear in phase and always stable. In most cases, the order Nfir of FIR filter is significantly larger than that of IIR filter with equivalent amplitude response niir. The NFIR/NIIR is usually 10 or more in magnitude or higher. IIR filters are generally simpler to compute. In many applications, the filter is not required to have strict linear phase, in these cases, usually because of the simple calculation and selection of IIR filter. For example, many of the filters in the speech coding are IIR filters, equalizer is generally used IIR filter. In other words, the real-time requirements are not very high occasions can consider the use of FIR filters, when the FIR filter order is longer, you can consider using FFT to calculate.

When designing IIR filters, the design index of the digital filter is usually transformed into the design index of the analog Low-pass filter, so as to determine the transfer function ha (s) of the analog Low-pass filters satisfying these indices, and then convert it to the required digital filter transfer function g (z).

The process of designing the filter is only to understand its principle. With the help of MATLAB powerful tool, the design of the filter becomes more simple.

In the MATLAB command window type Fdatool, you will start the filter design graphical interface. You can start by selecting the Digital filter control directly from the Simulink.

This paper mainly describes the design method of IIR digital filter.

Filter the signal coming in from the microphone.

Suppose we want to remove the 50hz frequency interference, at the same time the frequency of people speaking will not be more than 3400hz. We design a bandpass filter, the pass band is "80-3200", the sampling rate is 8k.

According to the above requirements, we change the relevant parameters to the following interface:

Click Design Filter, and after a few seconds, the following is displayed:

Can be seen: the order of the filter is 36, there is a sections:18. As a result of the implementation of the general is a 2-order cascade or parallel to achieve. So it is actually divided into 18 2-order sections to achieve.

The 36 order is the minimum order of the system to satisfy the demand. We can also make our own order in advance, the parameters are as follows:

At this point, the cutoff frequency attenuation parameters are no longer selectable and are fixed at 3 db:

The amplitude response of the final calculation is as follows:

We need to save the design filter coefficients for other programs to call.

MATLAB provides a direct derivation of the coefficient of the method.

"Targets"-> "Generate C Header"

You can modify the following to select "Generate"

In the MATLAB working directory can find you generated coefficient file, probably the following looks like this:

This document makes people not understand. Return to the Fdatool design interface to select "Analysis->filter coeffcients":

The coefficient interface is consistent with the data in this file.

Looking carefully at the data in the above interface, we find that the coefficients in the file actually divide it into two 2-order sections, with a gain. The purpose of the gain is to ensure the accuracy of the calculation and the stability of the system.

Select "Edit"-> "Convert to single", at which point the coefficients become familiar forms:

The resulting factor C header file is as follows:

Specify the order of 2, repeat the above steps generated IIR filter coefficient file is as follows:

OK, this is the end.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.