《DSP using MATLAB》Problem 2.20

代码:
%% ------------------------------------------------------------------------
%% 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的更多相关文章
- 《DSP using MATLAB》Problem 6.20
先放子函数: function [C, B, A, rM] = dir2fs_r(h, r); % DIRECT-form to Frequency Sampling form conversion ...
- 《DSP using MATLAB》Problem 5.20
窗外的知了叽叽喳喳叫个不停,屋里温度应该有30°,伏天的日子难过啊! 频率域的方法来计算圆周移位 代码: 子函数的 function y = cirshftf(x, m, N) %% -------- ...
- 《DSP using MATLAB》Problem 4.20
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 3.20
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 7.24
又到清明时节,…… 注意:带阻滤波器不能用第2类线性相位滤波器实现,我们采用第1类,长度为基数,选M=61 代码: %% +++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.23
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...
- 《DSP using MATLAB》Problem 6.15
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 6.12
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 6.10
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
随机推荐
- Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, ...
使用oracle数据库一个多月依赖这问题一直都得不到解决,最近任务不是很忙了,所以决定把这问题解决掉.写一篇文章做记录. 以上错误主要是net程序oracle数据库使用了Microsoft Enter ...
- (转)如何让ActiveXObject( "Microsoft.XmlDom ")对象在非IE浏览器下显示数据?firefox(火狐)
如何让ActiveXObject( "Microsoft.XmlDom ")对象在非IE浏览器下显示数据?firefox(火狐) 2013-09-10 16:01 2152人阅读 ...
- vue-router的hash模式与history模式的对比
Vue-router 中hash模式和history模式的关系在vue的路由配置中有mode选项 最直观的区别就是在url中 hash 带了一个很丑的 # 而history是没有#的mode:&quo ...
- Python3:爬取新浪、网易、今日头条、UC四大网站新闻标题及内容
Python3:爬取新浪.网易.今日头条.UC四大网站新闻标题及内容 以爬取相应网站的社会新闻内容为例: 一.新浪: 新浪网的新闻比较好爬取,我是用BeautifulSoup直接解析的,它并没有使用J ...
- Python3.x:bs4解析html基础用法
Python3.x:bs4解析html基础用法 代码: import urllib.request from bs4 import BeautifulSoup import re url = r'ht ...
- 实验五分析system_call中断处理过程
一.实验要求: 1.使用gdb跟踪分析一个系统调用内核函数 2.根据本周所学知识分析系统调用的过程,从system_call开始到iret结束之间的整个过程,并画出简要准确的流程图 二.实验步骤: 1 ...
- Python内置函数(9)——callable--转载
英文文档: callable(object) Return True if the object argument appears callable, False if not. If this re ...
- javascript method.
//**************************************************************** //* 名 称:DataLength //* 功 能:计算数据的长 ...
- ActiveStorage. 英文书Learnrails5.2的案例,看如何放到云上。
ActiveStorage. 英文书Learnrails5.2的案例 本例子目标:增加一个avatar image给每个用户. 准备: 需要安装Imagemagick software.它可以crea ...
- vue全家桶实现笔记本功能
一个通过vue实现的练手小项目,数据保存和导出通过node进行处理 成品截图: 安装vue-cli,webpack: cnpm install webpack -g cnpm install vue- ...