Main Content

过滤器设计画廊

此示例显示了如何使用Designfilt信号处理工具箱产品中的功能。

该画廊专为您而设计,以确定感兴趣的过滤器响应,查看代码并在您自己的项目中使用它。它包含每个可用过滤响应的示例Designfilt。但是,请注意,这些只是您可以为每种响应类型设计过滤器的几种可能的方法。有关规范集的详尽列表,请参见信号处理工具箱文档。

除非另有说明,否则在此示例中,所有频率单元都位于赫兹(Hertz),所有连锁和衰减值均在分贝中。

低通fir滤波器

Equiripple Design

fpass = 100;Fstop = 150; Apass = 1; Astop = 65; Fs = 1e3; d = designfilt(“ Lowpassfir”,,,,...'PassbandFrequency',,,,Fpass,“ stopbandfquency',fstop,...“ Passbandripple”,通过,'StopbandAttenuation',astop,...“ DesignMethod”,,,,'equiripple',,,,'采样率',,,,Fs); fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

低通IIR过滤器

最大平坦的设计

fpass = 100;Fstop = 150; Apass = 0.5; Astop = 65; Fs = 1e3; d = designfilt('lowpassiir',,,,...'PassbandFrequency',,,,Fpass,“ stopbandfquency',fstop,...“ Passbandripple”,通过,'StopbandAttenuation',astop,...“ DesignMethod”,,,,'butter',,,,'采样率',,,,Fs); fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

Ripple in Passband and Stopband

n = 8;fpass = 100;Apass = 0.5;astop = 65;FS = 1E3;d = distionfilt('lowpassiir',,,,...“ FilterOrder”,n,,...'PassbandFrequency',,,,Fpass,...“ Passbandripple”,通过,'StopbandAttenuation',astop,...'采样率',,,,Fs); fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

Highpass FIR Filters

Equiripple Design

FSTOP = 350;fpass = 400;astop = 65;Apass = 0.5;FS = 1E3;d = distionfilt(“ Highpassfir”,,,,“ stopbandfquency',fstop,...'PassbandFrequency',,,,Fpass,'StopbandAttenuation',astop,...“ Passbandripple”,通过,'采样率',fs,“ DesignMethod”,,,,'equiripple'); fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

Highpass IIR Filters

最大平坦的设计

FSTOP = 350;fpass = 400;astop = 65;Apass = 0.5;FS = 1E3;d = distionfilt(“高通”,,,,“ stopbandfquency',,,,Fstop ,...'PassbandFrequency',,,,Fpass,'StopbandAttenuation',astop,...“ Passbandripple”,通过,'采样率',fs,“ DesignMethod”,,,,'butter'); fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

Ripple in Passband and Stopband

n = 8;fpass = 400;astop = 65;Apass = 0.5;FS = 1E3;d = distionfilt(“高通”,,,,...“ FilterOrder”,n,,...'PassbandFrequency',,,,Fpass,...'StopbandAttenuation',astop,“ Passbandripple”,通过,...'采样率',,,,Fs); fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

带通道过滤器

Equiripple Design

FSTOP1 = 150;fpass1 = 200;fpass2 = 300;FSTOP2 = 350;ASTOP1 = 65;Apass = 0.5;ASTOP2 = 65;FS = 1E3;d = distionfilt(“ bandpassfir”,,,,...'StopbandFrequency1',,,,Fstop1,'PassBandFquency1',fpass1,...'PassbandFrequency2',fpass2,'StopbandFrequency2',fstop2,...'StopbandAttenuation1',astop1,“ Passbandripple”,,,,Apass,...“ stopbandAttEnuatuon2',astop2,...“ DesignMethod”,,,,'equiripple',,,,'采样率',,,,Fs); fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

不对称带衰减

n = 50;FSTOP1 = 150;fpass1 = 200;fpass2 = 300;FSTOP2 = 350;wstop1 = 3;wstop2 = 100;FS = 1E3;d = distionfilt(“ bandpassfir”,,,,...“ FilterOrder”,n,,...'StopbandFrequency1',,,,Fstop1,'PassBandFquency1',fpass1,...'PassbandFrequency2',fpass2,'StopbandFrequency2',fstop2,...“StopbandWeight1”,wstop1,'stopbandWeight2',wstop2,...“ DesignMethod”,,,,'equiripple',,,,'采样率',,,,Fs); fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

Bandpass IIR Filters

最大平坦的设计

FSTOP1 = 150;fpass1 = 200;fpass2 = 300;FSTOP2 = 350;ASTOP1 = 65;Apass = 0.5;ASTOP2 = 65;FS = 1E3;d = distionfilt('bandpassiir',,,,...'StopbandFrequency1',,,,Fstop1,'PassBandFquency1',fpass1,...'PassbandFrequency2',fpass2,'StopbandFrequency2',fstop2,...'StopbandAttenuation1',astop1,“ Passbandripple”,,,,Apass,...“ stopbandAttEnuatuon2',astop2,...“ DesignMethod”,,,,'butter',,,,'采样率',fs);fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

Ripple in Passband and Stopband

n = 8;fpass1 = 200;fpass2 = 300;ASTOP1 = 65;Apass = 0.5;ASTOP2 = 65;FS = 1E3;d = distionfilt('bandpassiir',,,,...“ FilterOrder”,n,,...'PassBandFquency1',fpass1,'PassbandFrequency2',fpass2,...'StopbandAttenuation1',astop1,“ Passbandripple”,,,,Apass,...“ stopbandAttEnuatuon2',astop2,...'采样率',fs);fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

带挡FIR滤波器

Equiripple Design

fpass1 = 100;FSTOP1 = 150;FSTOP2 = 350;fpass2 = 400;Apass1 = 0.5;astop = 65;Apass2 = 0.5;FS = 1E3;d = distionfilt(“ bandstopfir',,,,...'PassBandFquency1',fpass1,'StopbandFrequency1',,,,Fstop1,...'StopbandFrequency2',,,,Fstop2,'PassbandFrequency2',fpass2,...'PassBandripple1',apass1,'StopbandAttenuation',astop,...'PassBandripple2',apass2,...“ DesignMethod”,,,,'equiripple',,,,'采样率',fs);fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

Asymmetric Passband Ripples

N = 30; Fpass1 = 100; Fstop1 = 150; Fstop2 = 350; Fpass2 = 400; Wpass1 = 1; Wpass2 = 10; Fs = 1e3; d = designfilt(“ bandstopfir',,,,...“ FilterOrder”,n,,...'PassBandFquency1',fpass1,'StopbandFrequency1',,,,Fstop1,...'StopbandFrequency2',,,,Fstop2,'PassbandFrequency2',fpass2,...'PassbandWeight1',wpass1,'PassbandWeight2',wpass2,...“ DesignMethod”,,,,'equiripple',,,,'采样率',fs);fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

Bandstop IIR Filters

最大平坦的设计

fpass1 = 100;FSTOP1 = 150;FSTOP2 = 350;fpass2 = 400;Apass1 = 0.5;astop = 65;Apass2 = 0.5;FS = 1E3;d = distionfilt('bandstopiir',,,,...'PassBandFquency1',fpass1,'StopbandFrequency1',,,,Fstop1,...'StopbandFrequency2',,,,Fstop2,'PassbandFrequency2',fpass2,...'PassBandripple1',apass1,'StopbandAttenuation',astop,...'PassBandripple2',apass2,...“ DesignMethod”,,,,'butter',,,,'采样率',fs);fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

Ripple in Passband and Stopband

n = 8;Fpass1 = 125; Fpass2 = 375; Apass = 0.5; Astop = 65; Fs = 1e3; d = designfilt('bandstopiir',,,,...“ FilterOrder”,n,,...'PassBandFquency1',fpass1,'PassbandFrequency2',fpass2,...“ Passbandripple”,通过,'StopbandAttenuation',,,,Astop,...'采样率',,,,Fs); fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

任意级的fir过滤器

单频任任意级设计

n = 300;%频率在标准化单元中F1 = 0:0.01:0.18; F2 = [.2 .38 .4 .55 .562 .585 .6 .78]; F3 = 0.79:0.01:1; FreqVect = [F1 F2 F3];%频率向量%使用线性单元定义所需的响应A1 = .5+sin(2*pi*7.5*F1)/4;百分比正弦部分A2 = [.5 2.3 1 1 -.2 -.2 1 1];% Piecewise linear sectionA3 = .2+18*(1-F3).^2;%二次部分AmpVect = [A1 A2 A3]; d = designfilt('arbmagfir',,,,...“ FilterOrder”,n,,“振幅”,,,,AmpVect,'Frequencies',freqvect,...“ DesignMethod”,,,,'弗雷克斯普'); fvtool(d,“大幅度播放”,,,,“零相”

图零相响应包含轴对象。带有标题零相响应的轴对象包含2个类型行的对象。

多台低通设计,逐步衰减水平在停止条带上

N = 150; B = 2;% Number of bands%频率在标准化单元中f1 = [0 .25];百分比passbandf2 = [.3 .4 .401 .5 .501 .6 .601 .7 .701 .8 .801 .9 .901 1];% Stopbanda1 =一个(size(f1));线性单元中频段1的所需幅度%a2 =零(size(f2));% Desired amplitudes for band 2 in linear units% Vector of weightsw = 10。w1 = w(1:2);乐队1的重量%W2 = W(3:end);乐队2的重量%d = distionfilt('arbmagfir',,,,...“ FilterOrder”,n,,'NumBands',,,,B,...'BandFrequencies1',f1,'bandamplitudes1',A1,...'bandfrequencies2',f2,'bandamplitudes2',A2,...'BandWeights1',W1,'BandWeights2',W2);fvtool(d)

Figure Magnitude Response (dB) contains an axes object. The axes object with title Magnitude Response (dB) contains 2 objects of type line.

Differentiator FIR Filters

完整的乐队设计

N = 41; Fs = 1e3; d = designfilt(“区分”,,,,...“ FilterOrder”,n,,“ DesignMethod”,,,,'equiripple',,,,'采样率',,,,Fs); fvtool(d,“大幅度播放”,,,,“零相”,,,,“叠加分析”,,,,'阶段'

图零相响应和相位响应包含轴对象。带有标题零相响应的轴对象和相位响应包含类型行的对象。

Partial Band Design

N = 40; Fpass = 100; Fstop = 150; Fs = 1e3; d = designfilt(“区分”,,,,...“ FilterOrder”,n,,...'PassbandFrequency',,,,Fpass,“ stopbandfquency',fstop,...“ DesignMethod”,,,,'equiripple',,,,'采样率',,,,Fs); fvtool(d,“大幅度播放”,,,,“零相”,,,,“叠加分析”,,,,'阶段'

图零相响应和相位响应包含轴对象。带有标题零相响应的轴对象和相位响应包含类型行的对象。

希尔伯特冷杉过滤器

Equiripple Design

N = 40; Tw = 50; Fs = 1e3; d = designfilt('hilbertfir',,,,...“ FilterOrder”,n,,'TransitionWidth',TW,...“ DesignMethod”,,,,'equiripple',,,,'采样率',,,,Fs); fvtool(d,“大幅度播放”,,,,“零相”,,,,“叠加分析”,,,,'阶段'

图零相响应和相位响应包含轴对象。带有标题零相响应的轴对象和相位响应包含类型行的对象。

也可以看看

|