Analog filter和digital filter的联系:

z变换与Laplace从数学上的关系为:

但这种关系在实际应用上不好实现,因此通常使用biliner transform(https://en.wikipedia.org/wiki/Bilinear_transform)来简化这种关系。

analog frequecy 和digital frequecy的联系推导过程如下:

因此给定一个analog filter的传递函数,通过bilinear transform我们可以得到响应digital filter的频率响应和z变换

下面是一个例子:

https://ww2.mathworks.cn/help/signal/ug/iir-filter-design.html

Classical IIR Filter Design Using Analog Prototyping

The principal IIR digital filter design technique this toolbox provides is based on the conversion of classical lowpass analog filters to their digital equivalents. The following sections describe how to design filters and summarize the characteristics of the supported filter types. See Special Topics in IIR Filter Designfor detailed steps on  the filter design process.

Complete Classical IIR Filter Design

You can easily create a filter of any order with a lowpass, highpass, bandpass, or bandstop configuration using the filter design functions.

Filter Design Functions

Filter Type

Design Function

Bessel (analog only)

[b,a] = besself(n,Wn,options)

[z,p,k] = besself(n,Wn,options)

[A,B,C,D] = besself(n,Wn,options)

Butterworth

[b,a] = butter(n,Wn,options)

[z,p,k] = butter(n,Wn,options)

[A,B,C,D] = butter(n,Wn,options)

Chebyshev Type I

[b,a] = cheby1(n,Rp,Wn,options)

[z,p,k] = cheby1(n,Rp,Wn,options)

[A,B,C,D] = cheby1(n,Rp,Wn,options)

Chebyshev Type II

[b,a] = cheby2(n,Rs,Wn,options)

[z,p,k] = cheby2(n,Rs,Wn,options)

[A,B,C,D] = cheby2(n,Rs,Wn,options)

Elliptic

[b,a] = ellip(n,Rp,Rs,Wn,options)

[z,p,k] = ellip(n,Rp,Rs,Wn,options)

[A,B,C,D] = ellip(n,Rp,Rs,Wn,options)

By default, each of these functions returns a lowpass filter; you need to specify only the cutoff frequency that you want, Wn, in normalized units such that the Nyquist frequency is 1 Hz). For a highpass filter, append 'high' to the function's parameter list. For a bandpass or bandstop filter, specify Wn as a two-element vector containing the passband edge frequencies. Append 'stop' for the bandstop configuration.

Here are some example digital filters:

[b,a] = butter(5,0.4);                    % Lowpass Butterworth
[b,a] = cheby1(4,1,[0.4 0.7]); % Bandpass Chebyshev Type I
[b,a] = cheby2(6,60,0.8,'high'); % Highpass Chebyshev Type II
[b,a] = ellip(3,1,60,[0.4 0.7],'stop'); % Bandstop elliptic

To design an analog filter, perhaps for simulation, use a trailing 's' and specify cutoff frequencies in rad/s:

[b,a] = butter(5,0.4,'s');      % Analog Butterworth filter

All filter design functions return a filter in the transfer function, zero-pole-gain, or state-space linear system model representation, depending on how many output arguments are present. In general, you should avoid using the transfer function form because numerical problems caused by roundoff errors can occur. Instead, use the zero-pole-gain form which you can convert to a second-order section (SOS) form using zp2sos and then use the SOS form to analyze or implement your filter.

Note

All classical IIR lowpass filters are ill-conditioned for extremely low cutoff frequencies. Therefore, instead of designing a lowpass IIR filter with a very narrow passband, it can be better to design a wider passband and decimate the input signal.

Designing IIR Filters to Frequency Domain Specifications

This toolbox provides order selection functions that calculate the minimum filter order that meets a given set of requirements.

Filter Type

Order Estimation Function

Butterworth

[n,Wn] = buttord(Wp,Ws,Rp,Rs)

Chebyshev Type I

[n,Wn] = cheb1ord(Wp,Ws,Rp,Rs)

Chebyshev Type II

[n,Wn] = cheb2ord(Wp,Ws,Rp,Rs)

Elliptic

[n,Wn] = ellipord(Wp,Ws,Rp,Rs)

These are useful in conjunction with the filter design functions. Suppose you want a bandpass filter with a passband from 1000 to 2000 Hz, stopbands starting 500 Hz away on either side, a 10 kHz sampling frequency, at most 1 dB of passband ripple, and at least 60 dB of stopband attenuation. You can meet these specifications by using the butter function as follows.

[n,Wn] = buttord([1000 2000]/5000,[500 2500]/5000,1,60)
[b,a] = butter(n,Wn);
n =
12
Wn =
0.1951 0.4080

An elliptic filter that meets the same requirements is given by

[n,Wn] = ellipord([1000 2000]/5000,[500 2500]/5000,1,60)
[b,a] = ellip(n,1,60,Wn);
n =
5
Wn =
0.2000 0.4000

These functions also work with the other standard band configurations, as well as for analog filters.

Comparison of Classical IIR Filter Types

The toolbox provides five different types of classical IIR filters, each optimal in some way. This section shows the basic analog prototype form for each and summarizes major characteristics.

Butterworth Filter

The Butterworth filter provides the best Taylor series approximation to the ideal lowpass filter response at analog frequencies Ω  = 0 and Ω = ∞; for any order N, the magnitude squared response has 2N – 1 zero derivatives at these locations (maximally flat at Ω = 0 and Ω = ∞). Response is monotonic overall, decreasing smoothly from Ω = 0 to Ω = ∞. H(jΩ)=1/G2 at Ω = 1.

Chebyshev Type I Filter

The Chebyshev Type I filter minimizes the absolute difference between the ideal and actual frequency response over the entire passband by incorporating an equal ripple of Rp dB in the passband. Stopband response is maximally flat. The transition from passband to stopband is more rapid than for the Butterworth filter. H(jΩ)=10−Rp/20 at Ω = 1.

Chebyshev Type II Filter

The Chebyshev Type II filter minimizes the absolute difference between the ideal and actual frequency response over the entire stopband by incorporating an equal ripple of Rs dB in the stopband. Passband response is maximally flat.

The stopband does not approach zero as quickly as the type I filter (and does not approach zero at all for even-valued filter order n). The absence of ripple in the passband, however, is often an important advantage. H(jΩ)=10−Rs/20 at Ω = 1.

Elliptic Filter

Elliptic filters are equiripple in both the passband and stopband. They generally meet filter requirements with the lowest order of any supported filter type. Given a filter order n, passband ripple Rp in decibels, and stopband ripple Rs in decibels, elliptic filters minimize transition width. H(jΩ)=10−Rp/20 at Ω = 1.

Bessel Filter

Analog Bessel lowpass filters have maximally flat group delay at zero frequency and retain nearly constant group delay across the entire passband. Filtered signals therefore maintain their waveshapes in the passband frequency range. Frequency mapped and digital Bessel filters, however, do not have this maximally flat property; this toolbox supports only the analog case for the complete Bessel filter design function.

Bessel filters generally require a higher filter order than other filters for satisfactory stopband attenuation. H(jΩ)<1/G2 at Ω = 1 and decreases as filter order n increases.

Note

The lowpass filters shown above were created with the analog prototype functions besselapbuttapcheb1apcheb2ap, and ellipap. These functions find the zeros, poles, and gain of an nth-order analog filter of the appropriate type with a cutoff frequency of 1 rad/s. The complete filter design functions (besselfbuttercheby1cheby2, and ellip) call the prototyping functions as a first step in the design process. See Special Topics in IIR Filter Design for details.

To create similar plots, use n = 5 and, as needed, Rp = 0.5 and Rs = 20. For example, to create the elliptic filter plot:

[z,p,k] = ellipap(5,0.5,20);
w = logspace(-1,1,1000);
h = freqs(k*poly(z),poly(p),w);
semilogx(w,abs(h)), grid
xlabel('Frequency (rad/s)')
ylabel('Magnitude')

Direct IIR Filter Design

This toolbox uses the term direct methods to describe techniques for IIR design that find a filter based on specifications in the discrete domain. Unlike the analog prototyping method, direct design methods are not constrained to the standard lowpass, highpass, bandpass, or bandstop configurations. Rather, these functions design filters with an arbitrary, perhaps multiband, frequency response. This section discusses the yulewalk function, which is intended specifically for filter design; Parametric Modeling discusses other methods that may also be considered direct, such as Prony's method, Linear Prediction, the Steiglitz-McBride method, and inverse frequency design.

The yulewalk function designs recursive IIR digital filters by fitting a specified frequency response. yulewalk's name reflects its method for finding the filter's denominator coefficients: it finds the inverse FFT of the ideal specified magnitude-squared response and solves the modified Yule-Walker equations using the resulting autocorrelation function samples. The statement

[b,a] = yulewalk(n,f,m)

returns row vectors b and a containing the n+1 numerator and denominator coefficients of the nth-order IIR filter whose frequency-magnitude characteristics approximate those given in vectors f and mf is a vector of frequency points ranging from 0 to 1, where 1 represents the Nyquist frequency. mis a vector containing the specified magnitude response at the points in ff and m can describe any piecewise linear shape magnitude response, including a multiband response. The FIR counterpart of this function is fir2, which also designs a filter based on an arbitrary piecewise linear magnitude response. See FIR Filter Design for details.

Note that yulewalk does not accept phase information, and no statements are made about the optimality of the resulting filter.

Design a multiband filter with yulewalk and plot the specified and actual frequency response:

m = [0   0   1   1   0   0   1   1   0 0];
f = [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 1];
[b,a] = yulewalk(10,f,m);
[h,w] = freqz(b,a,128)
plot(f,m,w/pi,abs(h))

Generalized Butterworth Filter Design

The toolbox function maxflat enables you to design generalized Butterworth filters, that is, Butterworth filters with differing numbers of zeros and poles. This is desirable in some implementations where poles are more expensive computationally than zeros. maxflat is just like the butter function, except that it you can specify two orders (one for the numerator and one for the denominator) instead of just one. These filters are maximally flat. This means that the resulting filter is optimal for any numerator and denominator orders, with the maximum number of derivatives at 0 and the Nyquist frequency ω = π both set to 0.

For example, when the two orders are the same, maxflat is the same as butter:

[b,a] = maxflat(3,3,0.25)
b =
0.0317 0.0951 0.0951 0.0317
a =
1.0000 -1.4590 0.9104 -0.1978
[b,a] = butter(3,0.25)
b =
0.0317 0.0951 0.0951 0.0317
a =
1.0000 -1.4590 0.9104 -0.1978

However, maxflat is more versatile because it allows you to design a filter with more zeros than poles:

[b,a] = maxflat(3,1,0.25)
b =
0.0950 0.2849 0.2849 0.0950
a =
1.0000 -0.2402

The third input to maxflat is the half-power frequency, a frequency between 0 and 1 with a magnitude response of 1/G2.

You can also design linear phase filters that have the maximally flat property using the 'sym' option:

maxflat(4,'sym',0.3)
ans =
0.0331 0.2500 0.4337 0.2500 0.0331

For complete details of the maxflat algorithm, see Selesnick and Burrus [2].

IIR filter design from analog filter的更多相关文章

  1. Active Low-Pass Filter Design 低通滤波器设计

    2nd order RC Low-pass Filter Center frequency    fc = 23405.13869[Hz] Q factor                  Q = ...

  2. How do I convert an IIR filter into a FIR filter in digital signal processing?

    Maybe you were asking if there is some kind of design tool allowing to convert an IIR filter into an ...

  3. analog filter

    理想的filter如下: 但是实际的filter如下: 在实际应用中,我们更多的是用Fo和Q这两个parameter来design analog filter. Low-Pass Filter tra ...

  4. DirectX:在graph自己主动连线中增加自己定义filter(graph中遍历filter)

    为客户提供的视频播放的filter的測试程序中,採用正向手动连接的方式(http://blog.csdn.net/mao0514/article/details/40535791).因为不同的视频压缩 ...

  5. DirectX:在graph自动连线中加入自定义filter(graph中遍历filter)

    为客户提供的视频播放的filter的测试程序中,采用正向手动连接的方式(http://blog.csdn.net/mao0514/article/details/40535791),由于不同的视频压缩 ...

  6. Spring Security 入门(1-6-2)Spring Security - 内置的filter顺序、自定义filter、http元素和对应的filterChain

    Spring Security 的底层是通过一系列的 Filter 来管理的,每个 Filter 都有其自身的功能,而且各个 Filter 在功能上还有关联关系,所以它们的顺序也是非常重要的. 1.S ...

  7. Kalman Filter、Extended Kalman Filter以及Unscented Kalman Filter介绍

    模型定义 如上图所示,卡尔曼滤波(Kalman Filter)的基本模型和隐马尔可夫模型类似,不同的是隐马尔科夫模型考虑离散的状态空间,而卡尔曼滤波的状态空间以及观测空间都是连续的,并且都属于高斯分布 ...

  8. 黄聪:AngularJS如何在filter中相互调用filter

    调用方式如下: app.filter('filter2', function( $filter ) { return function( input) { return $filter('filter ...

  9. Bloom filter和Counting bloom filter

    Bloom filter原理: https://en.wikipedia.org/wiki/Bloom_filter 推导过程结合博客: https://blog.csdn.net/jiaomeng/ ...

随机推荐

  1. Blue Jeans[poj3080]题解

    题目 Description - The Genographic Project is a research partnership between IBM and The National Geog ...

  2. 精简Command版SqlHelper

    我在写CSharp程序对数据库进行操作时发现Connection对象起到了连接数据库的做用,实际执行SQL语句使用的是Command对象的方法,所以对SqlHelper进行了重写,具体如下: 一.创建 ...

  3. 零基础入门 Kubernetes,你需要知道这些

    Kubernetes是什么? 大概很多人对此都有疑问,不过在容器领域,Kubernetes却无人不晓. 阿里.字节跳动.腾讯.百度等中国互联网行业巨擘们,近年来都在深耕容器领域,而Kubernetes ...

  4. Leetcode Week1 Regular Expression Matching

    Question Given an input string (s) and a pattern (p), implement regular expression matching with sup ...

  5. Mysql中FIND_IN_SET()和IN区别简析

    来源:http://www.jb51.net/article/125744.htm 测试SQL: CREATE TABLE `test` ( `id` int(8) NOT NULL auto_inc ...

  6. H3C ARP配置

    一.ARP简介 ARP(Address Resolution Protocol,地址解析协议)是将IP地址解析为以太网MAC地址(或称物理地址)的协议. 在网络中,当主机或其它网络设备有数据要发送给另 ...

  7. HBuilderX开发app实现自动更新版本

      需求说明:使用MUI+Vue等技术并且通过HBuilderX打包开发移动app,在有版本更新时需要自动提示用户有新版本,并且可以点击下载自动安装. 思路说明: 应用打开时(使用Vue的生命周期mo ...

  8. 番外:你真的了解 Oracle 的启动流程吗?

    番外系列说明:该系列所有文章都将作为独立篇章进行知识点讲解,是对其他系列博文进行的补充说明,来自于博客园AskScuti. 主题:关于数据库启动流程的三个阶段 内容预览:本篇涉及数据库启动的三个阶段分 ...

  9. 虚拟磁盘VHD文件压缩方法

    问题描述 因工作需要在Mac上跑了一个VirtualBox虚拟win7,使用对win系统友好的vhd格式作为虚拟硬盘.经过一段时间使用发现vhd占用空间远大于虚拟磁盘使用量,想办法减减肥才行. 步骤整 ...

  10. 【网站】Kiwi浏览器中文网

    2020年1月1日上线 访问地址:http://huangenet.gitee.io/kiwibrowser/