x = [3, 11, 7, 0, -1, 4, 2]; nx = [-3:3];
h = [2, 3, 0, -5, 2, 1]; nh = [-1:4]; [y,ny] = conv_m(x,nx,h,nh)

结果:

 

 下面展示一些具体步骤:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Exameple 2.8 \n\n'); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Now is %20s, and it is %7s \n\n', time_stamp, wkd2);
%% ------------------------------------------------------------------------ % Input sequence
x = [3, 11, 7, 0, -1, 4, 2]; nx = [-3:3];
% Impulse Response sequence
h = [2, 3, 0, -5, 2, 1]; nh = [-1:4]; [y,ny] = conv_m(x,nx,h,nh) figure('NumberTitle', 'off', 'Name', 'Exameple 2.8')
set(gcf,'Color','white'); % x(k) and h(k)
subplot(2, 2, 1); stem(nx, x); axis([-5, 5, -6, 12]); grid on;
hold on;
stem(nh+0.1, h, 'r:');
a = axis; text(a(2)+0.5, a(3), 'k'); text(-1.5, 11, 'Solid :x Dashed :h');
title('x(k) & h(k)');
hold off; % x(k) and h(-k)
subplot(2, 2, 2); stem(nx, x);axis([-5, 5, -6, 12]); grid on;
hold on;
stem(-fliplr(nh)+0.1, fliplr(h), 'r:');
a = axis; text(a(2)+0.5, a(3), 'k'); text(-0.5, -1, 'n=0');
text(-1.5, 11, 'Solid :x Dashed :h');
title('x(k) and h(-k)');
hold off; % x(k) and h(-1-k)
subplot(2, 2, 3); stem(nx, x);axis([-5, 5, -6, 12]); grid on;
hold on;
stem(-fliplr(nh)+0.1-1, fliplr(h), 'r:');
a = axis; text(a(2)+0.5, a(3), 'k'); text(-1-0.5, -1, 'n=-1');
text(-1.5, 11, 'Solid :x Dashed :h');
title('x(k) and h(-1-k)');
hold off; % x(k) and h(2-k)
subplot(2, 2, 4); stem(nx, x);axis([-5, 5, -6, 12]); grid on;
hold on;
stem(-fliplr(nh)+0.1+2, fliplr(h), 'r:');
a = axis; text(a(2)+0.5, a(3), 'k'); text(2-0.5, -1, 'n=2');
text(-1.5, 11, 'Solid :x Dashed :h');
title('x(k) and h(2-k)');
hold off;

  运行结果:

左上角是x(k)和h(k);右上角是x(k)和h(-k),对h(k)进行了反转;左下角是x(k)和h(-1-k),对h(k)进行了反转后再向左移一位;

右下角是x(k)和h(2-k),对h(k)进行了反转后再向右移两位;

DSP using MATLAB 随书示例Example2.8的更多相关文章

  1. 《DSP using MATLAB》示例Example 10.4

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

  2. 《DSP using MATLAB》示例 Example 10.2

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

  3. 《DSP using MATLAB》示例 Example 10.1

    坚持到第10章了,继续努力! 代码: %% ------------------------------------------------------------------------ %% Ou ...

  4. 《DSP using MATLAB》 示例 Example 9.16

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

  5. 《DSP using MATLAB》示例 Example 9.14

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

  6. 《DSP using MATLAB》 示例 Example 9.12

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

  7. 《DSP using MATLAB》示例 Example 9.11

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

  8. 《DSP using MATLAB》示例 Example 9.10

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

  9. 《DSP using MATLAB》示例Example 9.9

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

随机推荐

  1. mybatis反向生成sql,基本的增删改查

    用到的几个文件 MyBatisGeneratorProxy.java package com.timestech.wsgk.test.tools; import static org.mybatis. ...

  2. linux 常用快捷键

    切换中英文输入法 Ctrl+space打开终端 Ctrl+Alt+T 终端下复制粘贴 Ctrl + Shift + c/v

  3. 【jquery】字符ascii码转换函数

    js 字符ascii码转换函数 字符转ascii码:用charCodeAt();ascii码砖字符:用fromCharCode(); 看一个小例子 <script> str="A ...

  4. mysql探究之null与not null

    相信很多用了mysql很久的人,对这两个字段属性的概念还不是很清楚,一般会有以下疑问: 1.我字段类型是not null,为什么我可以插入空值 2.为毛not null的效率比null高 3.判断字段 ...

  5. web前端打印总结

    资料: http://blog.5ibc.net/p/39927.html 正文: 简单的说就是映入两个css文件 <link/> <link/> 每个css文件都有一个属性是 ...

  6. oracle TIMESTAMP日期相减

    select extract(day from inter) * 24 * 60 * 60 + extract(hour from inter) * 60 * 60 + extract(minute ...

  7. 【转】深入Windows内核——C++中的消息机制

    上节讲了消息的相关概念,本文将进一步聊聊C++中的消息机制. 从简单例子探析核心原理 在讲之前,我们先看一个简单例子:创建一个窗口和两个按钮,用来控制窗口的背景颜色.其效果 图1.效果图  Win32 ...

  8. 20145206邹京儒《Java程序设计》第3周学习总结

    20145206 <Java程序设计>第3周学习总结 教材学习内容总结 第四章 4.1 定义类 class Clothes{ String color; char size; } publ ...

  9. svn删除所有.svn文件

    svn 删除所有的 .svn文件 find . -name .svn -type d -exec rm -fr {} \;

  10. 重温WCF之WCF传输安全(十三)(4)基于SSL的WCF对客户端采用证书验证(转)

    转载地址:http://www.cnblogs.com/lxblog/archive/2012/09/20/2695397.html 前一篇我们演示了基于SSL的WCF 对客户端进行用户名和密码方式的 ...