《DSP using MATLAB》Problem 2.15

代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.15 \n\n'); banner();
%% ------------------------------------------------------------------------ nx1 = [-3:3]; x1 = [2, -4, 5, 3, -1, -2, 6];
nh1 = [-1:3]; h1 = [1, -1, 1, -1, 1]; nx2 = [-2:2]; x2 = [1, 1, 0, 1, 1];
nh2 = [-3:0]; h2 = [1, -2, -3, 4]; nx3 = [-2:6]; x3 = (0.25 .^ (-nx3)) .* (stepseq(-1, -2, 6) - stepseq(4, -2, 6));
nh3 = [-2:6]; h3 = stepseq(0, -2, 6) - stepseq(5, -2, 6); nx4 = [-3:7]; x4 = (nx4/4) .* (stepseq(0, -3, 7) - stepseq(6, -3, 7)) ;
nh4 = [-3:7]; h4 = 2 * (stepseq(-2, -3, 7) - stepseq(3, -3, 7)); [y1, ny1] = conv_m(x1, nx1, h1, nh1);
[y2, ny2] = conv_m(x2, nx2, h2, nh2);
[y3, ny3] = conv_m(x3, nx3, h3, nh3);
[y4, ny4] = conv_m(x4, nx4, h4, nh4); figure('NumberTitle', 'off', 'Name', 'Problem 2.15')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(3,1,1); stem(nx1, x1); title('x1 sequence');
xlabel('n'); ylabel('x(n)') ;
grid on
subplot(3,1,2); stem(nh1, h1); title('h1 sequence');
xlabel('n'); ylabel('h1(n)');
grid on;
subplot(3,1,3); stem(ny1, y1); title('y1=x1*h1 sequence');
xlabel('n'); ylabel('y1(n)');
grid on; figure('NumberTitle', 'off', 'Name', 'Problem 2.15')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(3,1,1); stem(nx2, x2); title('x2 sequence');
xlabel('n'); ylabel('x2(n)') ;
grid on
subplot(3,1,2); stem(nh2, h2); title('h2 sequence');
xlabel('n'); ylabel('h2(n)');
grid on;
subplot(3,1,3); stem(ny2, y2); title('y2=x2*h2 sequence');
xlabel('n'); ylabel('y2(n)');
grid on; figure('NumberTitle', 'off', 'Name', 'Problem 2.15')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(3,1,1); stem(nx3, x3); title('x3 sequence');
xlabel('n'); ylabel('x3(n)') ;
grid on
subplot(3,1,2); stem(nh3, h3); title('h3 sequence');
xlabel('n'); ylabel('h3(n)');
grid on;
subplot(3,1,3); stem(ny3, y3); title('y3=x3*h3 sequence');
xlabel('n'); ylabel('y3(n)');
grid on; figure('NumberTitle', 'off', 'Name', 'Problem 2.15')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(3,1,1); stem(nx4, x4); title('x4 sequence');
xlabel('n'); ylabel('x4(n)') ;
grid on
subplot(3,1,2); stem(nh4, h4); title('h4 sequence');
xlabel('n'); ylabel('h4(n)');
grid on;
subplot(3,1,3); stem(ny4, y4); title('y4=x4*h4 sequence');
xlabel('n'); ylabel('y4(n)');
grid on;
运行结果:




《DSP using MATLAB》Problem 2.15的更多相关文章
- 《DSP using MATLAB》Problem 7.15
用Kaiser窗方法设计一个台阶状滤波器. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 6.15
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 5.15
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 4.15
只会做前两个, 代码: %% ---------------------------------------------------------------------------- %% Outpu ...
- 《DSP using MATLAB》Problem 8.15
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》Problem 5.38
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 5.31
第3小题: 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Out ...
- 《DSP using MATLAB》Problem 5.22
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% O ...
- 《DSP using MATLAB》Problem 5.21
证明: 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- 162. Find Peak Element(二分查找 )
A peak element is an element that is greater than its neighbors. Given an input array where num[i] ...
- MyEclipse优化,解决MyEclipse运行慢、卡顿问题
工具: myeclipse2015 2.0 最近想用myeclipse做一下测试,发现myeclipse运行非常卡,直接影响代码的开发,而且还出现软件卡退的情况,让我十分恼火. 一.加大JVM的非 ...
- springcloud15---zuul-fallback
package com.itmuch.cloud; import org.springframework.boot.SpringApplication; import org.springframew ...
- SQL学习笔记四之MySQL数据操作
阅读目录 一 介绍 二 插入数据INSERT 三 更新数据UPDATE 四 删除数据DELETE 五 查询数据SELECT 六 权限管理 一 介绍 MySQL数据操作: DML =========== ...
- 高可用Mysql架构_Haproxy+keepalived+mycat集群的配置
接上一篇文章http://www.cnblogs.com/wt645631686/p/8310891.html,虽然已经在原有两台mycat基础上增加了Haproxy作为mycat的中间服务器,不足的 ...
- 在JAVA可移植性的来源的三方面
软件可移植性的概念是与软件从某一环境转移到另一环境下的难易程度.为获得较高的可移植性,在设计过程中常采用通用的程序设计语言和运行支撑环境.尽量不用与系统的底层相关性强的语言.下面介绍JAVA的可移植性 ...
- sed删除包含指定字符串的所有行
1.以删除文件example.txt中包含字符串"=yes"的行为例,example.txt文件有以下内容: dadasdfsadf=yes=sds dsdadasdkfk dsd ...
- Vim编程常用命令
1.全文覆盖 程序发布到测试.开发环境后,经常需要远程登录Linux更改代码.平时在IDE中直接Ctrl+A.Ctrl+V覆盖整个文档,在vim中需要这样做 vim filename gg --跳到首 ...
- SpringMVC 原理和流程
请求到来时,第一个接受这个请求的前端控制器叫DispatcherServlet(这个需要在web.xml中配置),后端控制器叫Controller. 简化版流程: 1.spring mvc将所有的请求 ...
- noip 2018 D1T3 赛道修建
noip 2018 D1T3 赛道修建 首先考虑二分答案,这时需要的就是对于一个长度求出能在树中选出来的最多的路径条数.考虑到一条路径是由一条向上的路径与一条向下的路径构成,或者仅仅是向上或向下的路径 ...