%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Exameple 8.20 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %8s \n\n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ % Digital Filter Specifications:
wp = 0.2*pi; % digital passband freq in rad
ws = 0.3*pi; % digital stopband freq in rad
Rp = 1; % passband ripple in dB
As = 15; % stopband attenuation in dB % Analog prototype specifications: Inverse Mapping for frequencies
T = 1; Fs = 1/T; % set T = 1
OmegaP = (2/T)*tan(wp/2); % Prewarp(Cutoff) prototype passband freq
OmegaS = (2/T)*tan(ws/2); % Prewarp(cutoff) prototype stopband freq % Analog Elliptic Prototype Filter Calculation:
[cs, ds] = afd_elip(OmegaP, OmegaS, Rp, As); % Bilinear Transformation:
[b, a] = bilinear(cs, ds, T); [C, B, A] = dir2cas(b, a) % Calculation of Frequency Response:
[db, mag, pha, grd, ww] = freqz_m(b, a); %% -----------------------------------------------------------------
%% Plot
%% ----------------------------------------------------------------- figure('NumberTitle', 'off', 'Name', 'Exameple 8.20')
set(gcf,'Color','white');
M = 1; % Omega max subplot(2,2,1); plot(ww/pi, mag); axis([0, M, 0, 1.2]); grid on;
xlabel(' frequency in \pi units'); ylabel('|H|'); title('Magnitude Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.1778, 0.8913, 1]); subplot(2,2,2); plot(ww/pi, pha/pi); axis([0, M, -1.1, 1.1]); grid on;
xlabel('frequency in \pi nuits'); ylabel('radians in \pi units'); title('Phase Response');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-1:1:1]); subplot(2,2,3); plot(ww/pi, db); axis([0, M, -30, 10]); grid on;
xlabel('frequency in \pi units'); ylabel('Decibels'); title('Magnitude in dB ');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [-30, -15, -1, 0]); subplot(2,2,4); plot(ww/pi, grd); axis([0, M, 0, 15]); grid on;
xlabel('frequency in \pi units'); ylabel('Samples'); title('Group Delay');
set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
set(gca, 'YTickMode', 'manual', 'YTick', [0:5:15]);

  运行结果:

最新文章

  1. thinkphp 3.2与phpexcel
  2. 使用WinDbg调试SQL Server——入门
  3. 学习笔记——Maven实战(二)POM重构之增还是删
  4. linux 和 windows下的程序计时
  5. LightOj_1317 Throwing Balls into the Baskets
  6. bootstrap 导航布局
  7. Qt5-MSVC2012-qDebug中文乱码解决方法
  8. NodeJS stream 一:Buffer
  9. asp.net MVC NPOI导出excel通用
  10. jsp (2)
  11. 1005:Number Sequence(hdu,数学规律题)
  12. Web前端开发推荐书籍
  13. vmware 完全关闭时间同步
  14. 解决windows10 里vs2017 直接开始执行提示“此任务要求应用程序有提升的权限”1.
  15. 笔记六:python字符串运算与函数
  16. PyCharm引入自定义类报错
  17. WPF DataTemplate與ControlTemplate
  18. MySQL中表的复制
  19. Backup--查看备份的历史记录
  20. Activity重要函数

热门文章

  1. 最新版本的Struts2+Spring4+Hibernate4三大框架整合(截止2014-10-15,提供源码下载)
  2. ABP 学习问题集锦
  3. slim(4621✨)
  4. 12 Essential Bootstrap Tools for Web Designers
  5. Linux命令详解-date
  6. 【Demo】jQuery 设置简单的分页
  7. ansible来了
  8. 【Android测试】UI自动化代码优化之路
  9. Django之model操作(续)
  10. 【移动互联网开发】Zepto 使用中的一些注意点 【转】