代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 4.20 \n\n'); banner();
%% ------------------------------------------------------------------------ % ----------------------------------------------------
% 1 H1(z)
% ---------------------------------------------------- b = [1, 0, 0, 0, -1]*0.82805;
a = [1, 0, 0, 0, -0.81*0.81]; % [R, p, C] = residuez(b,a) Mp = (abs(p))'
Ap = (angle(p))'/pi %% ------------------------------------------------------
%% START a determine H(z) and sketch
%% ------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'P4.20 H(z) its pole-zero plot')
set(gcf,'Color','white');
zplane(b,a);
title('pole-zero plot'); grid on; %% ----------------------------------------------
%% END
%% ---------------------------------------------- % ------------------------------------
% h(n)
% ------------------------------------ [delta, n] = impseq(0, 0, 7);
h_check = filter(b, a, delta) % check sequence h_answer = 1.2621*impseq(0,0,7) ...
- 0.1085*(0.9*j).^n.*stepseq(0,0,7) - 0.1085*(-0.9*j).^n.*stepseq(0,0,7) ...
- 0.1085*(0.9).^n.*stepseq(0,0,7) - 0.1085*(-0.9).^n.*stepseq(0,0,7) % answer sequence %% --------------------------------------------------------------
%% START b |H| <H
%% 3rd form of freqz
%% --------------------------------------------------------------
w = [-500:1:500]*pi/500; 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', 'P4.20 DTFT and Real Imaginary Part ');
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
%% ================================================== %% =========================================================
%% Steady-State and Transient Response
%% =========================================================
bx = [1, -sqrt(2)/2]; ax = [1, -sqrt(2), 1]; by = 0.82805*conv(b, bx)
ay = conv(a, ax) [R, p, C] = residuez(by, ay) Mp_Y = (abs(p))'
Ap_Y = (angle(p))'/pi %% ------------------------------------------------------
%% START a determine Y(z) and sketch
%% ------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'P4.20 Y(z) its pole-zero plot')
set(gcf,'Color','white');
zplane(by, ay);
title('pole-zero plot'); grid on; % ------------------------------------
% y(n)
% ------------------------------------ LENGTH = 50; [delta, n] = impseq(0, 0, LENGTH-1);
y_check = filter(by, ay, delta); % check sequence y_answer = ( 2*0.414.*(cos(pi*n/4)) - 0.029*(0.9).^n ...
+ (-2*0.0356*(0.9).^n.*cos(pi*n/2) - 2*0.0625*(0.9).^n.*sin(pi*n/2) ...
- 0.0422*(-0.9).^n ) ) .* stepseq(0,0,LENGTH-1); yss = 2*0.414.*(cos(pi*n/4)) .* stepseq(0,0,LENGTH-1);
yts = - 0.029*(0.9).^n ...
+ (-2*0.0356*(0.9).^n.*cos(pi*n/2) - 2*0.0625*(0.9).^n.*sin(pi*n/2) ...
- 0.0422*(-0.9).^n ) .* stepseq(0,0,LENGTH-1); figure('NumberTitle', 'off', 'Name', 'P4.20 Yss and Yts ');
set(gcf,'Color','white');
subplot(2,1,1); stem(n, yss); grid on; %axis([0,1,0,1.5]);
title('Steady-State Response');
xlabel('n'); ylabel('Yss');
subplot(2,1,2); stem(n, yts); grid on; % axis([-1,1,-1,1]);
title('Transient Response');
xlabel('n'); ylabel('Yts'); figure('NumberTitle', 'off', 'Name', 'P4.20 Y(n) ');
set(gcf,'Color','white');
subplot(1,1,1); stem(n, y_answer); grid on; %axis([0,1,0,1.5]);
title('Total Response');
xlabel('n'); ylabel('Y(n)');

  运行结果:

系统函数的零极点图如下,4个极点都位于单位圆内。

全部输出的z变换,Y(z)的零极点图如下,单位圆上的极点和稳态输出有关,单位圆内部的极点和暂态输出有关。

这里显示输出的前50个元素,下面是全输出:

稳态输出和暂态输出如下图:

《DSP using MATLAB》Problem 4.20的更多相关文章

  1. 《DSP using MATLAB》Problem 6.20

    先放子函数: function [C, B, A, rM] = dir2fs_r(h, r); % DIRECT-form to Frequency Sampling form conversion ...

  2. 《DSP using MATLAB》Problem 5.20

    窗外的知了叽叽喳喳叫个不停,屋里温度应该有30°,伏天的日子难过啊! 频率域的方法来计算圆周移位 代码: 子函数的 function y = cirshftf(x, m, N) %% -------- ...

  3. 《DSP using MATLAB》Problem 3.20

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

  4. 《DSP using MATLAB》Problem 2.20

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

  5. 《DSP using MATLAB》Problem 7.24

    又到清明时节,…… 注意:带阻滤波器不能用第2类线性相位滤波器实现,我们采用第1类,长度为基数,选M=61 代码: %% +++++++++++++++++++++++++++++++++++++++ ...

  6. 《DSP using MATLAB》Problem 7.23

    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...

  7. 《DSP using MATLAB》Problem 6.15

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  8. 《DSP using MATLAB》Problem 6.12

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

  9. 《DSP using MATLAB》Problem 6.10

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...

随机推荐

  1. consensus sequence

    consensus sequence:称为一致序列.一些遗传元件(如启动子)中反复出现且很少有改变的DNA序列.不同种生物编码同一种蛋白质的基因也会有共有序列.通过序列比较发现相似但不一定完全相同的核 ...

  2. 49 BOM 和DOM

    一.BOM window 对象  1.确认,输入,    window.alert(123) // 弹框    let ret = window.confirm("是否删除") / ...

  3. UVA-12113 Overlapping Squares (回溯+暴力)

    题目大意:问能不能用不超过6张2x2的方纸在4x4的方格中摆出给定的图形? 题目分析:暴力枚举出P(9,6)种(最坏情况)方案即可. 代码如下: # include<iostream> # ...

  4. OC 继承

    一.基本概念 程序的世界和人类的“对象”世界在思想上是没有设么区别的,富二代继承了父母,自然就拥有了父母拥有的所有资源,子类继承了父类同样就拥有了父类所有的方法和属性(成员变量). 在这里动物是猫类和 ...

  5. 数据库故障诊断(Troubleshooting)之性能问题导致的数据库严重故障案例之一

    好久不来这里写东西,今天有点时间,来这里写点最近遇到的事情.前段时间,某电信业务用户因某核心生产库最近多次宕机重启,多方人员介入无果后,给我发来了邮件,大概意思就是现在该问题已经造成了比较严重的后果, ...

  6. echatrs可视化图在隐藏后显示不出来或是宽度出现问题

    最近在做一个可视化的项目,用了百度的ECharts.js作为可视化的视图框架,echarts的实例很多,基本能满足项目的需求,而且文档也相对完整.清晰,是个很不错的前端可视化框架. 我们的项目是使用b ...

  7. tensorflow安装相关问题

    安装步骤 要求:Python必须是64位根据TensorFlow的计算方式,TensorFlow的安装分为CPU版本和GPU版本对于Python3.5或者Python3.6,可以使用pip insta ...

  8. office2013安装和破解教程

    office2013安装和破解教程(非常简单) 工具/原料 ·电脑 ·office2013 ·HEU_KMS_Activator_CH_v7.6a(激活软件) 方法/步骤 1.1下载Microsoft ...

  9. Snagit安装步骤

    Snagit安装步骤 1解压文件 2运行文件下一步下一步 3拷贝汉化文件到安装目录 安装目录  D:\home\user\TechSmith\snagit 成功

  10. PHP:第二章——PHP中的switch语句

    <?php header("Content-Type:text/html;charset=utf-8"); /* switch语句: */ //例1: /*$i = 99; ...