《DSP using MATLAB》示例Example7.9
2024-10-16 22:09:42
代码:
wp = 0.2*pi; ws = 0.3*pi; As = 50; tr_width = ws - wp;
M = ceil((As-7.95)/(2.285*tr_width) + 1 ) + 1 n = [0:1:M-1]; beta = 0.1102*(As-8.7)
wc = (ws + wp)/2; % ideal LPF cutoff frequency
hd = ideal_lp(wc, M);
w_kai = (kaiser(M, beta))'; h = hd .* w_kai;
[db, mag, pha, grd, w] = freqz_m(h, [1]); delta_w = 2*pi/1000; % Rp = -(min(db(1:1:wp/delta_w+1))); % Actual Passband Ripple As = -round(max(db(ws/delta_w+1:1:501))) % Min Stopband attenuation %Plot figure('NumberTitle', 'off', 'Name', 'Exameple 7.9')
set(gcf,'Color','white'); subplot(2,2,1); stem(n, hd); axis([0 M-1 -0.1 0.3]); grid on;
xlabel('n'); ylabel('hd(n)'); title('Ideal Impulse Response'); subplot(2,2,2); stem(n, w_kai); axis([0 M-1 0 1.1]); grid on;
xlabel('n'); ylabel('w(n)'); title('Kaiser Window'); subplot(2,2,3); stem(n, h); axis([0 M-1 -0.1 0.3]); grid on;
xlabel('n'); ylabel('h(n)'); title('Actual Impulse Response'); subplot(2,2,4); plot(w/pi, db); axis([0 1 -100 10]); grid on;
xlabel('frequency in \pi units'); ylabel('Decibels'); title('Magnitude Response in dB');
运行结果:
我们注意到,Kaiser窗函数的特征,长度M=61,β =4.5513,滤波器Rp=0.0442dB,阻带衰减As=52dB,满足设计要求。
最新文章
- Objective C中数组排序几种情况的总结
- NAT技术
- while的使用
- PHP日期格式转时间戳
- SWIFT Button的基本用法
- Laravel 5 基础(三)- 向视图传送数据
- 九度OJ1172--哈夫曼树
- jQuery1.9(辅助函数)学习之——.serialize();
- const 还是 static readonly
- 常用类型转换 一.常用int和string类型转换
- 0_Simple__simpleAtomicIntrinsics + 0_Simple__simpleAtomicIntrinsics_nvrtc
- DrawerLayout实现网易新闻抽屉效果
- HDU5950 Recursive sequence (矩阵快速幂)
- 批量屏蔽符合条件的IP地址《目前仅测Centos 6 版本》
- SQL语句简单笔记
- FPGA中关于SPI的使用
- 怎么在XY图表中添加注解(LightningChart控件为例)?
- maven 下载不到jar包时候,更改阿里源
- Java 集合-Collections工具类
- Java编程规范[转]