《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
证明: 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- 在Mybatis中使用连表查询的一次实际应用
以前在工作中很少使用多表关联查询,对连表查询的具体作用和使用场景也没有很直观的认识,通过这次在项目中的实际应用,对此有了一定的认识,特记录如下. 关联表介绍: 分别是属性表attr_info.属性值表 ...
- ACM ICPC, Damascus University Collegiate Programming Contest(2018) Solution
A:Martadella Stikes Again 水. #include <bits/stdc++.h> using namespace std; #define ll long lon ...
- Entity Framework Code First级联删除(转)
使用Data Annotations: 如果我们要到一对主从表增加级联删除,则要在主表中的引用属性上增加Required关键字,如: public class Destination { public ...
- php-fpm开启报错-ERROR: An another FPM instance seems to already listen on /tmp/php-cgi.sock
在升级了php7.2.0版本之后,重新启动php-fpm过程中遇到一个报错. An another FPM instance seems to already listen on /tmp/php-c ...
- 第四章 consul cluster
1.vagrant 为了模拟集群效果,使用vagrant. 1.1.首先下载vagrant https://www.vagrantup.com/downloads.html 说明:浏览器下载可能比较慢 ...
- luogu P1192 台阶问题
https://www.luogu.org/problem/show?pid=1192 登楼梯 肯定能想到 dp[i] = dp[i-1] + dp[i-2] + ...+ dp[i-k] 然后想到 ...
- Python学习札记(二十二) 函数式编程3 filter & SyntaxError: unexpected EOF while parsing
参考: filter Problem SyntaxError: unexpected EOF while parsing 遇到该语法错误,一般是由于 括号不匹配 问题. Note 1.filter 用 ...
- 100W数据,测试复合索引
复合索引不是那么容易被catch到的. 两个查询条件都是等于的时候,才会被catch到. mysql> select count(*) from tf_user_index where sex ...
- JavaScript--变量和运算符
JavaScript--变量和运算符 一.心得 JavaScript语法:变量声明 var弱类型 var中可以是任何类型在JavaScript里面,单&单|是位运算符.变量没有值使用的话就是u ...
- SNMP:使用net-snmp捕捉trap
管理端:172.18.0.135 win7系统 代理端:172.18.0.212 Debian7.2 前提:代理端已配置snmp,可正常实现用SNMP协议实现系统信息监控 1.管理端下 ...