代码:

  1. %% ------------------------------------------------------------------------
  2. %% Output Info about this m-file
  3. fprintf('\n***********************************************************\n');
  4. fprintf(' <DSP using MATLAB> Exameple 8.19 \n\n');
  5.  
  6. time_stamp = datestr(now, 31);
  7. [wkd1, wkd2] = weekday(today, 'long');
  8. fprintf(' Now is %20s, and it is %8s \n\n', time_stamp, wkd2);
  9. %% ------------------------------------------------------------------------
  10.  
  11. % Digital Filter Specifications:
  12. wp = 0.2*pi; % digital passband freq in rad
  13. ws = 0.3*pi; % digital stopband freq in rad
  14. Rp = 1; % passband ripple in dB
  15. As = 15; % stopband attenuation in dB
  16.  
  17. % Analog prototype specifications: Inverse Mapping for frequencies
  18. T = 1; Fs = 1/T; % set T = 1
  19. OmegaP = (2/T)*tan(wp/2); % Prewarp(Cutoff) prototype passband freq
  20. OmegaS = (2/T)*tan(ws/2); % Prewarp(cutoff) prototype stopband freq
  21.  
  22. % Analog Chebyshev-2 Prototype Filter Calculation:
  23. [cs, ds] = afd_chb2(OmegaP, OmegaS, Rp, As);
  24.  
  25. % Bilinear Transformation:
  26. [b, a] = bilinear(cs, ds, T); [C, B, A] = dir2cas(b, a)
  27.  
  28. % Calculation of Frequency Response:
  29. [db, mag, pha, grd, ww] = freqz_m(b, a);
  30.  
  31. %% -----------------------------------------------------------------
  32. %% Plot
  33. %% -----------------------------------------------------------------
  34.  
  35. figure('NumberTitle', 'off', 'Name', 'Exameple 8.19')
  36. set(gcf,'Color','white');
  37. M = 1; % Omega max
  38.  
  39. subplot(2,2,1); plot(ww/pi, mag); axis([0, M, 0, 1.2]); grid on;
  40. xlabel(' frequency in \pi units'); ylabel('|H|'); title('Magnitude Response');
  41. set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
  42. set(gca, 'YTickMode', 'manual', 'YTick', [0, 0.1778, 0.8913, 1]);
  43.  
  44. subplot(2,2,2); plot(ww/pi, pha/pi); axis([0, M, -1.1, 1.1]); grid on;
  45. xlabel('frequency in \pi nuits'); ylabel('radians in \pi units'); title('Phase Response');
  46. set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
  47. set(gca, 'YTickMode', 'manual', 'YTick', [-1:1:1]);
  48.  
  49. subplot(2,2,3); plot(ww/pi, db); axis([0, M, -30, 10]); grid on;
  50. xlabel('frequency in \pi units'); ylabel('Decibels'); title('Magnitude in dB ');
  51. set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
  52. set(gca, 'YTickMode', 'manual', 'YTick', [-30, -15, -1, 0]);
  53.  
  54. subplot(2,2,4); plot(ww/pi, grd); axis([0, M, 0, 15]); grid on;
  55. xlabel('frequency in \pi units'); ylabel('Samples'); title('Group Delay');
  56. set(gca, 'XTickMode', 'manual', 'XTick', [0, 0.2, 0.3, M]);
  57. set(gca, 'YTickMode', 'manual', 'YTick', [0:5:15]);

  运行结果:

《DSP using MATLAB》示例Example 8.19的更多相关文章

  1. 《DSP using MATLAB》Problem 5.19

    代码: function [X1k, X2k] = real2dft(x1, x2, N) %% --------------------------------------------------- ...

  2. 《DSP using MATLAB》 Problem 3.19

    先求模拟信号经过采样后,对应的数字角频率: 明显看出,第3种采样出现假频了.DTFT是以2π为周期的,所以假频出现在10π-2kπ=0处. 代码: %% ----------------------- ...

  3. 《DSP using MATLAB》Problem 2.19

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  4. 《DSP using MATLAB》Problem 8.19

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  5. DSP using MATLAB 示例 Example3.19

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signa ...

  6. DSP using MATLAB 示例Example3.21

    代码: % Discrete-time Signal x1(n) % Ts = 0.0002; n = -25:1:25; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*a ...

  7. DSP using MATLAB示例Example3.18

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Continuous-time Fou ...

  8. DSP using MATLAB 示例Example3.23

    代码: % Discrete-time Signal x1(n) : Ts = 0.0002 Ts = 0.0002; n = -25:1:25; nTs = n*Ts; x1 = exp(-1000 ...

  9. DSP using MATLAB 示例Example3.22

    代码: % Discrete-time Signal x2(n) Ts = 0.001; n = -5:1:5; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*abs(nT ...

  10. DSP using MATLAB 示例Example3.17

随机推荐

  1. 教你如何使用理解懒Redis是更好的Redis

    前言 大家都知道 Redis 是单线程的.真正的内行会告诉你,实际上 Redis 并不是完全单线程,因为在执行磁盘上的特定慢操作时会有多线程.目前为止多线程操作绝大部分集中在 I/O 上以至于在不同线 ...

  2. Java管理扩展指南之JMX技术总览

    JMX(Java管理扩展)系列 JMX(Java管理扩展)系列旨在介绍包含于Java基础版本(Java SE)中的JMX技术.本系列提供了如何使用JMX重要技术特性的诸多示例. 一.JMX技术总览简要 ...

  3. LeetCode第[91]题(Java):Decode Ways(解码方法数)

    题目:解码方法数 难度:Medium 题目内容: A message containing letters from A-Z is being encoded to numbers using the ...

  4. 解决maven项目Cannot change version of project facet Dynamic web module to 3.0/3.1

    解决maven项目Cannot change version of project facet Dynamic web module to 3.0 1.打开项目所在目录下的.settings文件夹 打 ...

  5. [嵌入式培训笔记]----Linux命令简介

    Linux文件系统的结构类似一棵树,是从一个树根生长出来的.树根叫做/.从树根长出很多分叉,就这么一直生长下去.我们使用Linux操作系统的时候总是落在某个分叉上.ls命令可以帮助我们查看当前分叉上所 ...

  6. ffmpeg nvenc编码

    花时间研究了一些ffmpeg的nvenc,本来想我已经有了cuvid,然后又搞出来了nvenc,应该可以做个全套的英伟达的转码了,没想到ffmpeg官网下载的动态库没有cuvid,windows上编译 ...

  7. 新旧版ubuntu镜像免费下载

    链接:https://pan.baidu.com/s/1hUNfiyA_Npj9QQ0vNLJ_Xw 密码:6k6i

  8. HQL查询中取个别几个字段

    数据表:

  9. linux---tar命令,vim编辑器,磁盘分区,挂载,链接

    1) 将用户信息数据库文件和组信息数据库文件纵向合并为一个文件/1.txt(覆盖) [root@bogon ~]# cp /etc/passwd ./ [root@bogon ~]# cp /etc/ ...

  10. Math Issues

    Oh no, our Math object was "accidently" reset. Can you re-implement some of those function ...