Discretizing a Notch Filter
该示例显示了几种用于离散化槽滤波器的技术的比较。虽然控制系统组件通常在连续时间内设计,但通常必须离散地用于在数字计算机和嵌入式处理器上实现。
Continuous-Time Notch Filter
凹口滤波器被设计成在特定频率下抑制该频率的增益以特定频率拒绝信号内容。对于此示例,我们考虑以下陷波滤波器:
您可以绘制此过滤器的频率响应bode
命令:
H=tf([1 0.5 100],[1 5 100]); bode(H), grid
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离散化的)
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离散化的)
相比之下,突然突变和匹配的方法在频域中倾向于更好地在奈奎斯特频率附近引入较少的增益和相失真。例如,使用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'那'匹配'的)
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'那'突然刺激了的)
选择采样率
采样率越高,连续和离散响应之间的匹配越近。但是采样率或等同地,采样间隔有多大,采样间隔有多大?作为经验的规则,如果您希望连续和离散的模型可以紧密地匹配一些频率浪
那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'的)
如预测,离散化仍然相当准确TS <0.16
but starts breaking down for larger sampling intervals.
互动GUI
单击下面的链接以启动交互式GUI,进一步示出了通过选择离散化算法和采样率的选择性的影响。
notch_gui