代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.20 \n\n'); banner();
%% ------------------------------------------------------------------------ b = [1, -1]; a = [1]; %% -------------------------------------------------
%% 3 input sequence
%% -------------------------------------------------
n1 = [0:30];
x1 = 5 * (stepseq(0, 0, 30) - stepseq(20, 0, 30)); n2 = [-1:30];
x2 = n2 .* (stepseq(0, -1, 30)-stepseq(10, -1, 30)) + (20-n2) .* (stepseq(10, -1, 30)-stepseq(20, -1, 30)); n3= [-1:110];
x3 = sin(pi*n3/25) .* (stepseq(0, -1, 110)-stepseq(100, -1, 110)); %% ------------------------------------------------
%% 3 output sequence
%% ------------------------------------------------
y1 = filter(b, a, x1);
y2 = filter(b, a, x2);
y3 = filter(b, a, x3); figure('NumberTitle', 'off', 'Name', 'Problem 2.20')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(n1, x1); title('x1');
xlabel('n'); ylabel('x1(n)') ;
grid on
subplot(2,1,2); stem(n1, y1); title('y1');
xlabel('n'); ylabel('y1(n)');
grid on; figure('NumberTitle', 'off', 'Name', 'Problem 2.20')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(n2, x2); title('x2');
xlabel('n'); ylabel('x2(n)') ;
grid on
subplot(2,1,2); stem(n2, y2); title('y2');
xlabel('n'); ylabel('y2(n)');
grid on; figure('NumberTitle', 'off', 'Name', 'Problem 2.20')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(n3, x3); title('x3');
xlabel('n'); ylabel('x3(n)') ;
grid on
subplot(2,1,2); stem(n3, y3); title('y3');
xlabel('n'); ylabel('y3(n)');
grid on; %% ---------------------------------------------
%% stability
%% ---------------------------------------------
x4 = impseq(0, 0, 10);
y4 = filter(b, a, x4); fprintf('\nsum(abs(h)) = %f \n', sum(abs(y4))); figure('NumberTitle', 'off', 'Name', 'Problem 2.20 Zero-Pole')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色
pzmap(b, a); z = roots(a); magz = abs(z)

  运行结果:

上图看出,三角波信号的微分结果是方波。正弦信号的微分当然就是余弦信号了,见下图:

微分器的脉冲响应序列是绝对可和的,所以系统是稳定的。

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

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

  4. 《DSP using MATLAB》Problem 3.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. chrome 关闭安全模式

    chrome.exe --disable-web-security --user-data-dir

  2. (转)SQL Server 2008登录错误:无法连接到(local)的解决

    在一些朋友安装完SQL Server 2008之后大多会遇到连接出错的问题.特别对于我们这样的新手而言简直郁闷的要死,好不容易装玩了又出现了问题.此篇文章意在解决安装步骤没有问题,但安装后无法登录的问 ...

  3. MapReduce 过程详解 (用WordCount作为例子)

    本文转自 http://www.cnblogs.com/npumenglei/ .... 先创建两个文本文件, 作为我们例子的输入: File 1 内容: My name is Tony My com ...

  4. Android 创建SQLite数据库(一)

    Android内置了轻量级的数据库SQLite,这里将自己理解作个记录,方便自己复习. 一.首先,创建SQLite数据库比较常见的方式是通过Android提供的SQLiteOpenHelper来实现, ...

  5. HDU4642

    #include<stdio.h> #include<string.h> int main() { int i,j,n,m; int t; scanf("%d&quo ...

  6. Django:表结构发生变化需要执行命令

    Django:表结构发生变化需要执行命令 Django:表结构发生变化需要执行命令 mysite> python manage.py makemigrations blog #让 Django ...

  7. linux 系统忘记登录密码

    linux6/6.5再启动时,按e ->在输入行最后面 输入空格 再输入single ->启动设置密码即可 单用户模式 在centos7需要 按e -> 然后滚动列表,找到ro(ro ...

  8. BZOJ 3527 【ZJOI2014】 力

    题目链接:力 听说这道题是\(FFT\)板子题,于是我就来写了…… 首先可以发现这个式子:\[E_i=\sum_{j<i}\frac{q_j}{(i-j)^2}-\sum_{j>i}\fr ...

  9. 安装 bochs

    sudo apt-get install bochs 以后接着安装bochs-x

  10. 使用Bootstrap的suggest下拉插件

    前端代码 /*html代码*/ <input type="text" class="form-control search_ul" id="ca ...