matlab命令之FIR滤波器的设计

    命令并不是具体的讲解,只是把常用的记录下来,用的时候再具体的查,主要是知道有哪些命令,大体有什么功能。若有后续的解释会再添加文字链接。


1.fdatool  图形化设计数字滤波器

2.dfilt 生产成离散时间滤波器对象,

Construct a discrete-time, filter object  (是生成滤波器对象,而不是滤波器)

用法:dfilt.STRUCTURE(滤波器系数)。   

根据STRUCTURE的不同类型生成不同类型的滤波器对象,有很多类型

3.firpm FIR数字滤波器的最优化设计方法

FIRPM Parks-McClellan optimal equiripple FIR filter design. B=FIRPM(N,F,A) returns a length N+1 linear phase (real, symmetric coefficients) FIR filter which has the best approximation to the desired frequency response described by F and A in the minimax sense. F is a vector of frequency band edges in pairs, in ascending order between 0 and 1. 1 corresponds to the Nyquist frequency or half the sampling frequency. A is a real vector the same size as F which specifies the desired amplitude of the frequency response of the resultant filter B. 

B是返回的滤波器系数,N是滤波器阶数,F是频带的边界,例如带通滤波器{低通起点 低通终点 高通起点 高通终点],低通终点到高通起点是过渡带,A是表示幅度的,跟F的长度相同,

用法:h = firpm(30,[0 .3 .4 1],[1 1 0 0])     低通滤波器

4.fir1 用窗函数的方法设计脉冲响应滤波器

b = fir1(n,Wn)
b = fir1(n,Wn,'ftype')
b = fir1(n,Wn,window)
b = fir1(n,Wn,'ftype',window)

b = fir1(...,'normalization')

4.fir2 设计基于频率采样的FIR滤波器     (没怎么遇见过)

5.fdesign 生成一定类型的滤波器对象

Create a filter design object for designing discrete-time filters

生成的对象是用来设计滤波器的,看来“对象”并不是指滤波器,可以看成对滤波器的规格参数的描述(specification)

Hs = FDESIGN.TYPE(SPECTYPE,SPEC1, SPEC2,...) 

TYPE的类型可以有:

  fdesign.bandpass    - Designs bandpass filters.
    fdesign.bandstop    - Designs bandstop filters.
    fdesign.decim       - Designs decimators.
    fdesign.halfband    - Designs halfband filters.
    fdesign.highpass    - Designs highpass filters.
    fdesign.interp      - Designs interpolators.
    fdesign.lowpass     - Designs lowpass filters.
    fdesign.nyquist     - Designs nyquist filters.

    fdesign.src         - Designs sample-rate converters.

6.firls 

Design filters using filter specifications from a filter design object and a least-square minimization technique

用滤波器对象来设计滤波器,这里的specification就是上面fdesign生成的滤波器对象。

d = fdesign.interp(2,'pl,tw',60,.04); % 60 is the polyphase 
                                      % length

hm = firls(d);

查看fdesign生成的滤波器对象:

>> d
d =
           ResponseType: 'Halfband with filter order and transition width'
      SpecificationType: 'PL,TW'
            Description: {2x1 cell}
    InterpolationFactor: 2
    NormalizedFrequency: true
                     Fs: 'Normalized'
        PolyphaseLength: 60

        TransitionWidth: 0.0400

>> get(d,'responsetype')

ans =

    Halfband with filter order and transition width

查看firls生成的滤波器

>> hm 

hm = 
         FilterStructure: 'Direct-Form FIR Polyphase Interpolator'
               Numerator: [1x120 double]
     InterpolationFactor: 2
    ResetBeforeFiltering: 'on'
                  States: [59x1 double]

     NumSamplesProcessed: 0

7.window 各种窗函数的设计

WINDOW(@WNAME,N) returns an N-point window of type specified
    by the function handle @WNAME in a column vector.  @WNAME can
    be any valid window function name, for example:
 
    @bartlett       - Bartlett window.
    @barthannwin    - Modified Bartlett-Hanning window. 
    @blackman       - Blackman window.
    @blackmanharris - Minimum 4-term Blackman-Harris window.
    @bohmanwin      - Bohman window.
    @chebwin        - Chebyshev window.
    @flattopwin     - Flat Top window.
    @gausswin       - Gaussian window.
    @hamming        - Hamming window.
    @hann           - Hann window.
    @kaiser         - Kaiser window.
    @nuttallwin     - Nuttall defined minimum 4-term Blackman-Harris window.
    @parzenwin      - Parzen (de la Valle-Poussin) window.
    @rectwin        - Rectangular window.
    @tukeywin       - Tukey window.
    @triang         - Triangular window.

其中@符号后面的单词是窗的类型,每个都是一个函数,可以用来设计对应的窗函数,不同的窗主瓣宽度,衰减不同,一般是根据阻带衰减来确定使用哪类窗函数,

8.freqz 

Compute the frequency response of discrete-time filters, adaptive filters, and multirate filters 

用法:

[h,w] = freqz(ha)

[h,w] = freqz(ha,n)

[h,w] = freqz(hd)

[h,w] = freqz(hd,n)

[h,w] = freqz(hm)

[h,w] = freqz(hm,n)

h保存频率响应,复数形式,包含幅频响应和相频响应

9.fvtool

Open the Filter Visualization Tool (FVTool)

用法:

    fvtool(b,a)

    fvtool(b1,a1,b2,a2,...bn,an)

    fvtool(Hd1,Hd2,...)

    fvtool(..跟上面类似...,'TYPE');

TYPE包括phase,magnitude


你可能感兴趣的:(关于matlab的使用)