代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.19 \n\n'); banner();
%% ------------------------------------------------------------------------ b = [1, 2, 0, 1]; a = [1, -0.5, 0.25];
n = [0:100]; h1 = impz(b, a, n); x = impseq(0, 0, 100); h2 = filter(b, a, x); figure('NumberTitle', 'off', 'Name', 'Problem 2.19 Impulse response')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(n, h1); title('impz function');
xlabel('n'); ylabel('h1(n)') ;
grid on
subplot(2,1,2); stem(n, h2); title('filter function');
xlabel('n'); ylabel('h2(n)');
grid on; %% ---------------------------------------------
%% stability
%% --------------------------------------------- fprintf('\n1st impz : sum(abs(h)) = %f \n', sum(abs(h1)));
fprintf('\n2nd filter: sum(abs(h)) = %f \n', sum(abs(h2))); figure('NumberTitle', 'off', 'Name', 'Problem 2.19 Zero-Pole')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色
pzmap(b, a); z = roots(a); magz = abs(z) %% --------------------------------------
%% another input
%% --------------------------------------
n2 = [0:200];
x2 = (5 + 3*cos(0.2*pi*n2) + 4*sin(0.6*pi*n2)) .* stepseq(0, 0, 200); y2 = filter(b, a, x2); figure('NumberTitle', 'off', 'Name', 'Problem 2.19 Another input')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(n2, x2); title('input');
xlabel('n2'); ylabel('x2(n)') ;
grid on
subplot(2,1,2); stem(n2, y2); title('Output');
xlabel('n2'); ylabel('y2(n)');
grid on;

  运行结果:

上图是分别用impz和filter函数得到的脉冲响应序列。

系统的脉冲响应序列是绝对可和的,另外系统的极点都位于单位圆内部(见下图),所以系统是稳定的。

给系统一个新的输入,计算新的输出,如下图:

《DSP using MATLAB》Problem 2.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 8.19

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

  4. 《DSP using MATLAB》Problem 7.16

    使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

  5. 《DSP using MATLAB》Problem 5.18

    代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% O ...

  6. 《DSP using MATLAB》Problem 5.5

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

  7. 《DSP using MATLAB》Problem 5.4

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

  8. 《DSP using MATLAB》Problem 5.3

    这段时间爬山去了,山中林密荆棘多,沟谷纵横,体力增强不少. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

  9. 《DSP using MATLAB》Problem 4.23

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

随机推荐

  1. cocos-lua基础学习(10)scheduler类学习笔记

    local scheduler = cc.Director:getInstance():getScheduler() local function shouldNotCrash(dt) end loc ...

  2. hdu1700 Points on Cycle

    地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=1700 题目: Points on Cycle Time Limit: 1000/1000 MS ...

  3. sysctl.conf文件详解

    本文转自:http://www.cnblogs.com/Rosanna/p/3446557.html 使文件立刻生效命令:/sbin/sysctl -p /proc/sys目录下存放着大多数内核参数, ...

  4. springcloud12---sidecar

    Sidecar:异构平台整合.做了一个桥 package com.itmuch.cloud; import org.springframework.boot.SpringApplication; im ...

  5. 20145221 《Java程序设计》第八周学习总结

    20145221 <Java程序设计>第八周学习总结 教材学习内容总结 第十五章部分 - 通用API 通用API 日志: 日志对信息安全意义重大,审计.取证.入侵检测等都会用到日志信息 日 ...

  6. 图解Git命令【转】

    本文转载自:https://github.com/geeeeeeeeek/git-recipes/wiki/4.1-%E5%9B%BE%E8%A7%A3Git%E5%91%BD%E4%BB%A4 此页 ...

  7. 试着用React写项目-利用styled-components解决样式问题

    转载请注明出处:王亟亟的大牛之路 啰嗦之前先安利,会渐渐丰富前端的知识点 https://github.com/ddwhan0123/Useful-Open-Source-Android 昨天用web ...

  8. Mac下安装hexo Error: Cannot find module './build/Release/DTraceProviderBindings 解决

    参考: Github:Mac 下已经装了hexo,仍旧报错 官方文档 $ npm install hexo --no-optional if it doesn't work try $ npm uni ...

  9. 2017NOIP模拟赛-科普基地

    今天回来打的第一场NOIP难度的试题,结果惨不忍睹.写一下每道题的做法,然后每道题犯的__弱智__错误 UPD:2018.9.15 突然这篇题解就变成很多大佬要看的了,因为之前是写给自己看的,所以写的 ...

  10. python 递归求阶乘

    #用递归函数求 n 阶乘的值 def factorial(i): : else: )# sum=n*(n-)!所以直接调用自身 n=int(input('请输入阶乘数:')) ): print('%d ...