代码:

%% ------------------------------------------------------------------------
%% 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的更多相关文章

  1. 《DSP using MATLAB》Problem 7.15

    用Kaiser窗方法设计一个台阶状滤波器. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

  2. 《DSP using MATLAB》Problem 6.15

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

  3. 《DSP using MATLAB》Problem 5.15

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

  4. 《DSP using MATLAB》Problem 4.15

    只会做前两个, 代码: %% ---------------------------------------------------------------------------- %% Outpu ...

  5. 《DSP using MATLAB》Problem 8.15

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

  6. 《DSP using MATLAB》Problem 5.38

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

  7. 《DSP using MATLAB》Problem 5.31

    第3小题: 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Out ...

  8. 《DSP using MATLAB》Problem 5.22

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

  9. 《DSP using MATLAB》Problem 5.21

    证明: 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

随机推荐

  1. Python: 分数运算

    fractions 模块可以被用来执行包含分数的数学运算 >>> from fractions import Fraction >>> a = Fraction(5 ...

  2. 反射获取成员方法(Method)

    1.1.1 反射公开的非静态的成员方法 Method getDeclaredMethod(String name,Class ... parameterTypes)获取某个方法. 说明: 1)在Cla ...

  3. Linux 笔记 #04# Installing Tomcat 8 on Debian

    失败一 ※ 失败二  ※ 失败三 ※ 完 1- 确认机型: root@iZwz:~# lsb_release -a LSB Version: core-2.0-amd64:core-2.0-noarc ...

  4. Core Java 3

    p270~p272 1.创建异常类. 步骤:1)定义一个派生于(继承)Exception或者其子类的类. 2)添加两个构造方法:一个是默认构造器,另一个是带有详细描述信息的构造器. import ja ...

  5. PHP中使用OpenSSL下openssl_verify验证签名案例

    使用OpenSSL那么需要先了解一下http://www.cnblogs.com/wt645631686/p/8390936.html <?php //demo $json = '{" ...

  6. RocEDU.阅读.写作《苏菲的世界》书摘(六)

    * 身为一个经验主义者,休姆期许自己要整理前人所提出的一些混淆不清的思想与观念,包括中世纪到十七世纪这段期间,理性主义哲学家留传下来的许多言论和著作.休姆建议,人应回到对世界有自发性感觉的状态.他说, ...

  7. NSwag给api加上说明

    参考http://petstore.swagger.io 给controller加上description https://github.com/RSuter/NSwag/issues/1803 xm ...

  8. 【bzoj2721】[Violet 5]樱花

    题目传送门:https://www.lydsy.com/JudgeOnline/problem.php?id=2721 好久没做数学题了,感觉有些思想僵化,走火入魔了. 这道题就是求方程$ \frac ...

  9. codevs 2216 行星序列 线段树+延迟标记(BZOJ 1798)

    2216 行星序列  时间限制: 2 s  空间限制: 256000 KB     题目描述 Description “神州“载人飞船的发射成功让小可可非常激动,他立志长大后要成为一名宇航员假期一始, ...

  10. 关联规则&Apriori算法

    2017-12-02 14:27:18 一.术语 Items:项,简记I Transaction:所有项的一个非空子集,简记T Dataset:Transaction的一个集合,简记D 关联规则: 一 ...