今天清明放假的第二天,早晨出去吃饭时天气有些阴,十点多开始“清明时节雨纷纷”了。
母亲远在他乡看孙子,挺劳累的。父亲照顾生病的爷爷……
我打算今天把《DSP using MATLAB》第7章结束,剩下的几个例子看不懂了,先跳过去。
ch7最后一个:
代码:
ws = 0.6*pi; wp = 0.75*pi; Rp = 0.5; As = 50; [delta1, delta2] = db2delta(Rp, As); f = [ws, wp]/pi; m = [0, 1]; delta = [delta2, delta1]; delta [N, f, m, weights] = firpmord(f, m, delta); N h = firpm(N, f, m, weights); [db, mag, pha, grd, w] = freqz_m(h, [1]); delta_w = 2*pi/1000; wsi = ws/delta_w; wpi = wp/delta_w; Asd = -max(db(1:1:wsi)) N = N + 2 h = firpm(N, f, m, weights); [db, mag, pha, grd, w] = freqz_m(h, [1]); [Hr, ww, a, L] = Hr_Type1(h); Asd = -max(db(1:1:wsi)) M = N + 1
运行结果:
注意:代码中让N+2,是为了保证滤波器阶数为偶数。最优M=29。