代码:

b = [1, 0]; a = [1, -0.9];               %  

%% ----------------------------------------------
%% START a determine H(z) and sketch
%% ----------------------------------------------
figure('NumberTitle', 'off', 'Name', 'Example4.11a H(z) its pole-zero plot')
set(gcf,'Color','white');
zplane(b,a);
title('pole-zero plot'); grid on; %% ----------------------------------------------
%% END
%% ---------------------------------------------- %% --------------------------------------------------------------
%% START b |H| <H
%% 1st form of freqz
%% --------------------------------------------------------------
[H,w] = freqz(b,a,100); % 1st form of freqz magH = abs(H); angH = angle(H); realH = real(H); imagH = imag(H); %% ================================================
%% START H's mag ang real imag
%% ================================================
figure('NumberTitle', 'off', 'Name', 'Example4.11b H its mag ang real imag');
set(gcf,'Color','white');
subplot(2,2,1); plot(w/pi,magH); grid on; %axis([0,1,0,1.5]);
title('Magnitude Response');
xlabel('frequency in \pi units'); ylabel('Magnitude |H|');
subplot(2,2,3); plot(w/pi, angH/pi); grid on; % axis([-1,1,-1,1]);
title('Phase Response');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); subplot('2,2,2'); plot(w/pi, realH); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot('2,2,4'); plot(w/pi, imagH); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary');
%% ==================================================
%% END H's mag ang real imag
%% ================================================== %% ---------------------------------------------------------------
%% END b |H| <H
%% --------------------------------------------------------------- %% --------------------------------------------------------------
%% START b |H| <H
%% 2nd form of freqz
%% --------------------------------------------------------------
[H,w] = freqz(b,a,200,'whole'); % 2nd form of freqz magH = abs(H(1:101)); angH = angle(H(1:101)); realH = real(H); imagH = imag(H); %% ================================================
%% START H's mag ang real imag
%% ================================================
figure('NumberTitle', 'off', 'Name', 'Example4.11b using 2nd form freqz ');
set(gcf,'Color','white');
subplot(2,2,1); plot(w/pi,magH); grid on; %axis([0,1,0,1.5]);
title('Magnitude Response');
xlabel('frequency in \pi units'); ylabel('Magnitude |H|');
subplot(2,2,3); plot(w/pi, angH/pi); grid on; % axis([-1,1,-1,1]);
title('Phase Response');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); subplot('2,2,2'); plot(w/pi, realH); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot('2,2,4'); plot(w/pi, imagH); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary');
%% ==================================================
%% END H's mag ang real imag
%% ================================================== %% ---------------------------------------------------------------
%% END b |H| <H
%% --------------------------------------------------------------- %% --------------------------------------------------------------
%% START b |H| <H
%% 3rd form of freqz
%% --------------------------------------------------------------
w = [0:1:100]*pi/100; H = freqz(b,a,w);
%[H,w] = freqz(b,a,200,'whole'); % 3rd form of freqz magH = abs(H); angH = angle(H); realH = real(H); imagH = imag(H); %% ================================================
%% START H's mag ang real imag
%% ================================================
figure('NumberTitle', 'off', 'Name', 'Example4.11b using 3rd form freqz ');
set(gcf,'Color','white');
subplot(2,2,1); plot(w/pi,magH); grid on; %axis([0,1,0,1.5]);
title('Magnitude Response');
xlabel('frequency in \pi units'); ylabel('Magnitude |H|');
subplot(2,2,3); plot(w/pi, angH/pi); grid on; % axis([-1,1,-1,1]);
title('Phase Response');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); subplot('2,2,2'); plot(w/pi, realH); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot('2,2,4'); plot(w/pi, imagH); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary');
%% ==================================================
%% END H's mag ang real imag
%% ================================================== %% ---------------------------------------------------------------
%% END b |H| <H
%% ---------------------------------------------------------------

  结果:

《DSP using MATLAB》示例Example4.11的更多相关文章

  1. DSP using MATLAB 示例 Example3.11

    用到的性质 上代码: n = -5:10; x = rand(1,length(n)); k = -100:100; w = (pi/100)*k; % freqency between -pi an ...

  2. DSP using MATLAB 示例Example2.11

    上代码: b = [1]; a = [1, -1, 0.9]; n = [-20:120]; h = impz(b,a,n); set(gcf,'Color','white'); %subplot(2 ...

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

  4. DSP using MATLAB 示例 Example3.19

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

  5. DSP using MATLAB示例Example3.18

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

  6. DSP using MATLAB 示例Example3.8

    代码: x = rand(1,11); n = 0:10; k = 0:500; w = (pi/500)*k; % [0,pi] axis divided into 501 points. X = ...

  7. DSP using MATLAB 示例Example3.7

    上代码: x1 = rand(1,11); x2 = rand(1,11); n = 0:10; alpha = 2; beta = 3; k = 0:500; w = (pi/500)*k; % [ ...

  8. DSP using MATlAB 示例Example2.10

    上代码 % noise sequence 1 x = [3, 11, 7, 0, -1, 4, 2]; nx = [-3:3]; % given signal x(n) [y,ny] = sigshi ...

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

随机推荐

  1. C#关于new的用法

    1.运算符就是在实例化一个类的时候(运算符的用法) A a=new A(); 2.new 约束指定泛型类声明中的任何类型参数都必须有公共无参数构造函数.当泛型类创建类型的新实例时,将此约束应用于类型参 ...

  2. 【leetcode】Search in Rotated Sorted Array II(middle)☆

    Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this ...

  3. IOS开发中与设计沟通之字体大小转换

    px:相对长度单位.像素(Pixel).pt:绝对长度单位.点(Point).1in = 2.54cm = 25.4 mm = 72pt = 6pc 具体换算是: Points Pixels Ems ...

  4. java 500/404错误总结

    404是路径错误,简单的说就是你的页面找不到后台执行它的代码(未找到服务端代码)500最常见的就是你的编程语言语法错误导致的(服务端代码报错)

  5. mac os 下打开FTP服务器

    mac下一般用smb服务来进行远程文件访问,但要用FTP的话,高版本的mac os默认关掉了,可以用如下命令打开: sudo -s launchctl load -w /System/Library/ ...

  6. 使用Apache+Dreamweaver(或者H-builder)搭建php开发环境

    使用得工具说明 php+Apache服务器+Dreamweaver+mysql数据库 下载安装好wamp,可以在网上直接百度下载,为了方便,我给放个百度云的链接.wamp下载:链接:http://pa ...

  7. Mybatis 学习笔记1

    ---恢复内容开始--- 什么是 MyBatis ? MyBatis 是支持定制化 SQL.存储过程以及高级映射的优秀的持久层框架.MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获 ...

  8. CentOS yum的详细使用方法

    yum是什么yum = Yellow dog Updater, Modified主要功能是更方便的添加/删除/更新RPM包.它能自动解决包的倚赖性问题.它能便于管理大量系统的更新问题yum特点可以同时 ...

  9. ios layer 动画-(transform.rotation篇)

    x轴旋转: CABasicAnimation *theAnimation; theAnimation=[CABasicAnimation animationWithKeyPath:@"tra ...

  10. weblogic无需用户名密码启动Server

    创建了Server-0. 但每次启动需要手工输入管理账户和密码. 并不方便. 现在要让它自动输入并启动.一. 新建security文件夹 # cd $WEBLOGIC_HOME/servers/Ser ...