代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Exameple 8.17 \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 Butterworth Prototype Filter Calculation:
[cs, ds] = afd_butt(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.17')
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. Java——表格
  2. ASP.NET MVC分页实现
  3. STL --- UVA 123 Searching Quickly
  4. Struts2标签实现for循环
  5. 下载安装APK
  6. 一个适用于层级目录结构的makefile模版
  7. 【转】移动端App测试实用指南
  8. BZOJ 1019: [SHOI2008]汉诺塔( dp )
  9. 跨平台网络通信与server编程框架库(acl库)介绍
  10. iOS项目——基本框架搭建
  11. windows下mysql 5.7以上版本安装及遇到的问题
  12. idea 2018.1 for mac JRebel破解
  13. GIS中栅格数据结构的显示与计算
  14. mybatis源码解析10---StatementHandler解析
  15. 学习笔记3—matlab中load特殊用法
  16. python之绘制图形库turtle
  17. 快速配置java环境变量
  18. 基于Oracle的EntityFramework的WEBAPI2的实现(三)—— 建立APIController及设置返回类型JSON、XML等
  19. 【BZOJ】2705: [SDOI2012]Longge的问题
  20. 黑马学习Ajax 概念和基本使用

热门文章

  1. Hibernate与 MyBatis的比较(转,留作以后细细钻研)
  2. Linux加载/usr/local/lib中的so库
  3. mysql数据库优化课程---13、mysql基础操作
  4. html合并单元格
  5. js今日小结—Ajax、前端安全、GET&amp;POST、闭包、HTTPS
  6. Comprehensive Python Cheatsheet
  7. Highcharts 基本曲线图;Highcharts 带有数据标签曲线图表;Highcharts 异步加载数据曲线图表
  8. zoj1654
  9. JBPM4入门——1.jbpm简要介绍
  10. 多线程相关(pthread 、NSThread 、GCD、NSOperation)