Main Content

Discretizing a Notch Filter

该示例显示了几种用于离散化槽滤波器的技术的比较。虽然控制系统组件通常在连续时间内设计,但通常必须离散地用于在数字计算机和嵌入式处理器上实现。

Continuous-Time Notch Filter

凹口滤波器被设计成在特定频率下抑制该频率的增益以特定频率拒绝信号内容。对于此示例,我们考虑以下陷波滤波器:

H S. 的) = S. 2 + 0. 5. S. + 1 0. 0. S. 2 + 5. S. + 1 0. 0.

您可以绘制此过滤器的频率响应bode命令:

H=tf([1 0.5 100],[1 5 100]); bode(H), grid

图包含2个轴对象。Axes object 1 contains an object of type line. This object represents H. Axes object 2 contains an object of type line. This object represents H.

This notch filter provides a 20dB attenuation at the frequency w = 10 rad/s.

选择离散化方法

您可以将连续时间系统分开C2D.command. Several discretization algorithms are supported by Control System Toolbox™, including:

  • Zero-order hold

  • 一阶持有

  • 冲动不变

  • Tustin(双线性近似)

  • 带频率预警的Tustin

  • 匹配的杆和零

哪种方法选择取决于应用程序和要求。

The zero- and first-order hold methods and the impulse-invariant method are well-suited for discrete approximations in the time domain. For example, the step response of the ZOH discretization matches the continuous-time step response at each time step (independently of the sampling rate):

ts = 0.1;HDZ = C2D(H,TS,'zoh');步骤(h,'B'那Hdz,'r'), 传奇('Continuous''在10 Hz离散化的)

Figure contains an axes object. The axes object contains 2 objects of type line. These objects represent Continuous, Discretized at 10 Hz.

Similarly, the impulse-invariant discretization has the same impulse response as the original system:

G = tf([1 -3],[1 2 10]); Gd = c2d(G,Ts,'IMP');脉冲(g,'B',gd,'r') 传奇('Continuous''在10 Hz离散化的)

Figure contains an axes object. The axes object contains 2 objects of type line. These objects represent Continuous, Discretized at 10 Hz.

相比之下,突然突变和匹配的方法在频域中倾向于更好地在奈奎斯特频率附近引入较少的增益和相失真。例如,使用ZOH,Tustin和匹配的算法比较连续时间陷波滤波器的Bode响应及其离散化:

Hdt = c2d(H,Ts,'tustin');HDM = C2D(H,TS,'匹配');BODE(H,'B'那Hdz,'r',HDT,'m',HDM,'G',{1 100}),网格传奇('Continuous''zoh''tustin''匹配'的)

图包含2个轴对象。轴对象1包含4个类型的线。这些物体代表连续的,ZOH,Tustin,匹配。轴对象2包含类型线的4个对象。这些物体代表连续的,ZOH,Tustin,匹配。

This comparison indicates that the Matched method provides the most accurate frequency-domain approximation of the notch filter. However, you can further improve the accuracy of the Tustin algorithm by specifying a prewarping frequency equal to the notch frequency. This ensures accurate match near w = 10 rad/s:

Hdp = c2d(H,Ts,'prewarp'10);BODE(H,'B',HDT,'m',HDP,'G',{1 100}),网格传奇('Continuous''tustin''突然刺激了的)

图包含2个轴对象。轴对象1包含3个类型线的对象。这些物体代表连续,汀汀,汀汀与预警。轴对象2包含3个类型线的对象。这些物体代表连续,汀汀,汀汀与预警。

选择采样率

采样率越高,连续和离散响应之间的匹配越近。但是采样率或等同地,采样间隔有多大,采样间隔有多大?作为经验的规则,如果您希望连续和离散的模型可以紧密地匹配一些频率那make sure that the Nyquist frequency (sampling rate times Pi) is at least twice。对于陷波滤波器,您需要保持10 RAD / S附近的形状,因此奈奎斯特频率应超出20 rad / s,这给出了最多pi / 20 = 0.16秒的采样周期。

要确认此选择,请将匹配的离散化与采样期0.1,0.15和0.3进行比较:

HD1 = C2D(H,0.1,'m');HD2 = C2D(H,0.15,'m');HD3 = C2D(H,0.3,'m');BODE(H,'B',HD1,'r',HD2,'m',hd3,'G',{1 100}),网格传奇('Continuous''ts = 0.1''ts = 0.15''Ts = 0.3'的)

图包含2个轴对象。轴对象1包含4个类型的线。These objects represent Continuous, Ts = 0.1, Ts = 0.15, Ts = 0.3. Axes object 2 contains 4 objects of type line. These objects represent Continuous, Ts = 0.1, Ts = 0.15, Ts = 0.3.

如预测,离散化仍然相当准确TS <0.16but starts breaking down for larger sampling intervals.

互动GUI

单击下面的链接以启动交互式GUI,进一步示出了通过选择离散化算法和采样率的选择性的影响。

打开凹口离散化GUI

notch_gui

数字陷波滤波器离散化包含3轴objects and other objects of type uicontrol. Axes object 1 with title Bode Diagram of Notch Filter contains 3 objects of type line. These objects represent Continuous, Discretized. Axes object 2 contains 3 objects of type line. Axes object 3 with title Filtered Sine Wave at Notch Frequency contains 4 objects of type line.