代码:
wp = 0.2*pi; ws = 0.3*pi; Rp = 0.25; As = 50; [delta1, delta2] = db2delta(Rp, As); [N, f, m, weights] = firpmord([wp, ws]/pi, [1, 0], [delta1, delta2]); N f m weights h = firpm(N, f, m, weights); [db, mag, pha, grd, w] = freqz_m(h, [1]); delta_w = 2*pi/1000; wsi = ws/delta_w+1; wpi = wp/delta_w; Asd = -max(db(wsi:1:501)) N = 46; h = firpm(N, f, m, weights); [db, mag, pha, grd, w] = freqz_m(h, [1]); [Hr, ww, b, L] = Hr_Type2(h); delta_w = 2*pi/1000; wsi = ws/delta_w+1; wpi = wp/delta_w; Asd = -max(db(wsi:1:501)) M = N + 1
运行结果:
注意,我们是在最大阻带衰减As的值超过给定的50dB后停止迭代的,最优的M=47。这个值要比采用窗函数(Kaiser窗时M=61)和频率采样方法(M=60)
要小得多。
时间: 2024-10-17 19:54:11