%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Exameple 8.7 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %9s \n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ Wp = 0.2*pi; Ws = 0.3*pi; Rp = 1; As =16; Ripple = 10 ^ (-Rp/20); Attn = 10 ^ (-As/20); % Analog filter design:
[b, a] = afd_chb2(Wp, Ws, Rp, As); % Calculation of second-order sections:
[C, B, A] = sdir2cas(b, a) % Calculation of Frequency Response:
[db, mag, pha, ww] = freqs_m(b, a, 0.5*pi); % Calculation of Impulse Response:
[ha, x, t] = impulse(b, a); %% -----------------------------------------------------------------
%% Plot
%% ----------------------------------------------------------------- figure('NumberTitle', 'off', 'Name', 'Exameple 8.7')
set(gcf,'Color','white');
M = 0.5; % Omega max subplot(2,2,1); plot(ww/pi, mag); axis([0, M, 0, 1.2]); grid on;
xlabel(' Analog 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.1585, 0.8913, 1]); subplot(2,2,2); plot(ww/pi, db); axis([0, M, -30, 10]); grid on;
xlabel('Analog 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, -16, -1, 0]); subplot(2,2,3); plot(ww/pi, pha/pi); axis([0, M, -1.1, 1.1]); grid on;
xlabel('Analog 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:0.5:1]); subplot(2,2,4); plot(t, ha); axis([0, 30, -0.4, 0.3]); grid on;
xlabel('time in seconds'); ylabel('ha(t)'); title('Impulse Response');

  运行结果:

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

  1. 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 ...

  2. DSP using MATLAB 示例 Example3.19

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

  3. DSP using MATLAB示例Example3.18

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

  4. 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 ...

  5. 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 ...

  6. DSP using MATLAB 示例Example3.17

  7. DSP using MATLAB示例Example3.16

    代码: b = [0.0181, 0.0543, 0.0543, 0.0181]; % filter coefficient array b a = [1.0000, -1.7600, 1.1829, ...

  8. DSP using MATLAB 示例 Example3.15

    上代码: subplot(1,1,1); b = 1; a = [1, -0.8]; n = [0:100]; x = cos(0.05*pi*n); y = filter(b,a,x); figur ...

  9. DSP using MATLAB 示例 Example3.13

    上代码: w = [0:1:500]*pi/500; % freqency between 0 and +pi, [0,pi] axis divided into 501 points. H = ex ...

  10. DSP using MATLAB 示例 Example3.12

    用到的性质 代码: n = -5:10; x = sin(pi*n/2); k = -100:100; w = (pi/100)*k; % freqency between -pi and +pi , ...

随机推荐

  1. Generator 函数的语法

    简介 § ⇧ 基本概念 Generator 函数是 ES6 提供的一种异步编程解决方案,语法行为与传统函数完全不同.本章详细介绍 Generator 函数的语法和 API,它的异步编程应用请看< ...

  2. Nginx 启动报错 “/var/run/nginx/nginx.pid" failed”

    问题: 重启虚拟机后,再次重启nginx会报错: open() "/var/run/nginx/nginx.pid" failed (2: No such file or dire ...

  3. 第九天 1-8 RHEL7软件包管理

    在RHEL7中,主要有 RPM 和 YUM 两种包管理 1.RPM包管理--使用rpm命令对rpm软件包进行管理rpm命令格式:[有很多,自己可以man一下,这里只列举一下常用的]rpm -ivh [ ...

  4. CentOS6.5 linux 逻辑卷管理 调整分区大小

    [root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 50 ...

  5. python环境配置

    有个chatserver.py文件写的服务器代码,mac下终端执行python  chatserver.py 总是报上面的错,求解 ImportError: No module named twist ...

  6. Spring入门1. IoC入门实例

    Spring入门1. IoC入门实例 Reference:Java EE轻量级解决方案——S2SH 前言: 之前学习过关于Spring的一点知识,曾经因为配置出现问题,而总是被迫放弃学习这些框架技术, ...

  7. int argc,char *argv[]

    main()函数是操作系统调用的,argc表示传入参数的个数,argv[]表示传入的参数. argv[0]表示exe文件所在的路径,所以argc默认为1. main函数的参数是可以通过dos窗口传入, ...

  8. linux中安装eclipse--CnetOS6.5

    01.去官网下载指定的eclipse安装包 02.使用xftp把下载的eclipse安装包放入到linux系统的指定位置03.到指定的目录下!使用命令解压下载的文件tar -zxvf 文件名称04. ...

  9. LeetCode OJ:Add and Search Word - Data structure design(增加以及搜索单词)

    Design a data structure that supports the following two operations: void addWord(word) bool search(w ...

  10. LeetCode OJ:Nim Game(Nim游戏)

    You are playing the following Nim Game with your friend: There is a heap of stones on the table, eac ...