matlab firceqrip,Constrained equiripple FIR filter

本文介绍了使用MATLAB的firceqrip函数设计各种FIR滤波器的方法,包括默认参数和可选输入参数的使用。通过五个具体的示例,展示了如何设置不同参数以实现不同的滤波器特性,如指定停止边缘响应、滤波器斜率、最小相位等。同时,还探讨了使用'invsinc'关键字来塑造滤波器的通带,并对比了不同设计参数对滤波器性能的影响。
摘要由CSDN通过智能技术生成

Examples

To introduce a few of the variations on FIR filters that you

design with firceqrip, these five examples cover

both the default syntax b = firceqrip(n,wo,del) and

some of the optional input arguments. For each example, the input

arguments n, wo, and del remain

the same.

Filter design using firceqrip

Design a 30th order FIR filter using firceqrip.

b = firceqrip(30,0.4,[0.05 0.03]); fvtool(b)

8e34b8b76d2f0af29bcdf0a768f11d64.png

Design a 30th order FIR filter with the stopedge keyword to define the response at the edge of the filter stopband.

b = firceqrip(30,0.4,[0.05 0.03],'stopedge'); fvtool(b)

792c11c497237250c0171662e6eef3ed.png

Design a 30th order FIR filter with the slope keyword and r = 20.

b = firceqrip(30,0.4,[0.05 0.03],'slope',20,'stopedge'); fvtool(b)

698cc9805c03e66ad0025c9c4c7abacf.png

Design a 30th order FIR filter defining the stopband and specifying that the resulting filter is minimum phase with the min keyword.

b = firceqrip(30,0.4,[0.05 0.03],'stopedge','min'); fvtool(b)

98b382d8d963c4c19c46c109a0ecefd5.png

Comparing this filter to the filter in Figure 1. The cutoff frequency wo = 0.4 now applies to the edge of the stopband rather than the point at which the frequency response magnitude is 0.5.

Viewing the zero-pole plot shown here reveals this is a minimum phase FIR filter - the zeros lie on or inside the unit circle, z = 1

fvtool(b,'polezero')

62c529d80e2f3b64fe2cf1abc535a68d.png

Design a 30th order FIR filter with the invsinc keyword to shape the filter passband with an inverse sinc function.

b = firceqrip(30,0.4,[0.05 0.03],'invsinc',[2 1.5]); fvtool(b)

458e07183906ffd0132fe49d2f5ad1d2.png

The inverse sinc function being applied is defined as 1/sinc(2*w)^1.5.

Inverse-Dirichlet-Sinc-Shaped Passband

Design two order 30 constrained equiripple FIR filters with inverse-Dirichlet-sinc-shaped passbands. The cutoff frequency in both designs is pi/4 radians/sample. Set C=1 in one design C=2 in the second design. The maximum passband and stopband ripple is 0.05. Set p=1 in one design and p=2 in the second design.

Design the filters.

b1 = firceqrip(30,0.25,[0.05 0.05],'invdiric',[1 1]);

b2 = firceqrip(30,0.25,[0.05 0.05],'invdiric',[2 2]);

Obtain the filter frequency responses using freqz. Plot the magnitude responses.

[h1,~] = freqz(b1,1);

[h2,w] = freqz(b2,1);

plot(w,abs(h1)); hold on;

plot(w,abs(h2),'r');

axis([0 pi 0 1.5]);

xlabel('Radians/sample');

ylabel('Magnitude');

legend('C=1 p=1','C=2 p=2');

290f5aa21da89512231992e7279f92e7.png

Inspect the stopband ripple in the design with C=1 and p=1. The constrained design sets the maximum ripple to be 0.05. Zoom in on the stopband from the cutoff frequency of pi/4 radians/sample to 3pi/4 radians/sample.

figure;

plot(w,abs(h1));

set(gca,'xlim',[pi/4 3*pi/4]);

grid on;

bb2ed8300c8e117e28b4589f85b8bdbc.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值