代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.14 \n\n'); banner();
%% ------------------------------------------------------------------------ n1 = [-10:30];
x1 = cos(pi*n1/4) .* (stepseq(-5, -10, 30)-stepseq(25, -10, 30)); n2 = [-10:30];
x2 = (0.9 .^ (-n2)) .* (stepseq(0, -10, 30) - stepseq(20, -10, 30)); n3 = [-10:10];
x3 = round( 5 * (-1+2*rand(21,1))); [x4, n4] = impseq(2, -10, 30); figure('NumberTitle', 'off', 'Name', 'Problem 2.14')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(4,1,1); stem(n1, x1); title('x1=cos(\pin/4)[u(n+5)-u(n-25)] sequence');
xlabel('n1'); ylabel('x(n)') ;
grid on
subplot(4,1,2); stem(n2, x2); title('x2=(10/9)^n[u(n)-u(n-20)] sequence');
xlabel('n2'); ylabel('x2(n2)');
grid on; subplot(4,1,3); stem(n3, x3); title('x3=round(5w(n)) sequence');
xlabel('n3'); ylabel('x3(n3)');
grid on; subplot(4,1,4); stem(n4, x4); title('x4=\delta(n-2) sequence');
xlabel('n4'); ylabel('x4(n4)');
grid on; %% ------------------------------------------
%% Commutation
%% ------------------------------------------
[y1, ny1] = conv_m(x1, n1, x2, n2);
[y2, ny2] = conv_m(x2, n2, x1, n1); figure('NumberTitle', 'off', 'Name', 'Problem 2.14 Commutation')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(ny1, y1); title('x1*x2 sequence');
xlabel('ny1'); ylabel('y1(n)') ;
grid on
subplot(2,1,2); stem(ny2, y2); title('x2*x1 sequence');
xlabel('ny2'); ylabel('y2(n)');
grid on; %% -----------------------------------------------
%% Association
%% -----------------------------------------------
[y1, ny1] = conv_m(x1, n1, x2, n2);
[y2, ny2] = conv_m(y1, ny1, x3, n3); [y3, ny3] = conv_m(x2, n2, x3, n3);
[y4, ny4] = conv_m(y3, ny3, x1, n1); figure('NumberTitle', 'off', 'Name', 'Problem 2.14 Association')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(ny2, y2); title('(x1*x2)*x3 sequence');
xlabel('ny2'); ylabel('y2(n)') ;
grid on
subplot(2,1,2); stem(ny4, y4); title('x1*(x2*x3) sequence');
xlabel('ny4'); ylabel('y4(n)');
grid on; %% ------------------------------------------------
%% Distribution
%% ------------------------------------------------
[y1, ny1] = sigadd(x2, n2, x3, n3);
[y2, ny2] = conv_m(x1, n1, y1, ny1); [y3, ny3] = conv_m(x1, n1, x2, n2);
[y4, ny4] = conv_m(x1, n1, x3, n3);
[y5, ny5] = sigadd(y3, ny3, y4, ny4); figure('NumberTitle', 'off', 'Name', 'Problem 2.14 Distribution')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(ny2, y2); title('x1*[x2+x3] sequence');
xlabel('ny2'); ylabel('y2(n)') ;
grid on
subplot(2,1,2); stem(ny5, y5); title('x1*x2+x1*x3 sequence');
xlabel('ny5'); ylabel('y5(n)');
grid on; %% -------------------------------------------------------------
%% Identity
%% ------------------------------------------------------------- [y1, ny1] = conv_m(x1, n1, x4, n4);
[y2, ny2] = sigshift(x1, n1, 2); [y3, ny3] = conv_m(x2, n2, x4, n4);
[y4, ny4] = sigshift(x2, n2, 2); [y5, ny5] = conv_m(x3, n3, x4, n4);
[y6, ny6] = sigshift(x3, n3, 2); figure('NumberTitle', 'off', 'Name', 'Problem 2.14 Identity1')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(ny1, y1); title('x1*\delta(n-n0) n0=2 sequence');
xlabel('ny1'); ylabel('y1(n)') ;
grid on
subplot(2,1,2); stem(ny2, y2); title('x1(n-n0) sequence');
xlabel('ny2'); ylabel('y2(n)');
grid on; figure('NumberTitle', 'off', 'Name', 'Problem 2.14 Identity2')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(ny3, y3); title('x2*\delta(n-n0) n0=2 sequence');
xlabel('ny3'); ylabel('y3(n)') ;
grid on
subplot(2,1,2); stem(ny4, y4); title('x2(n-n0) sequence');
xlabel('ny4'); ylabel('y4(n)');
grid on; figure('NumberTitle', 'off', 'Name', 'Problem 2.14 Identity3')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色 subplot(2,1,1); stem(ny5, y5); title('x3*\delta(n-n0) n0=2 sequence');
xlabel('ny5'); ylabel('y5(n)') ;
grid on
subplot(2,1,2); stem(ny6, y6); title('x3(n-n0) sequence');
xlabel('ny6'); ylabel('y6(n)');
grid on;

  运行结果:

《DSP using MATLAB》Problem 2.14的更多相关文章

  1. 《DSP using MATLAB》Problem 7.14

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

  2. 《DSP using MATLAB》Problem 6.14

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

  3. 《DSP using MATLAB》Problem 5.14

    说明:这两个小题的数学证明过程都不会,欢迎博友赐教. 直接上代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

  4. 《DSP using MATLAB》Problem 4.14

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

  5. 《DSP using MATLAB》Problem 8.14

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

  6. 《DSP using MATLAB》Problem 7.26

    注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...

  7. 《DSP using MATLAB》Problem 6.8

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

  8. 《DSP using MATLAB》Problem 5.7

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

  9. 《DSP using MATLAB》Problem 7.27

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

随机推荐

  1. 026-B树(一)

    1.内节点:非根非叶子节点,即非根的分支节点. 2.名称:B-树=B树=平衡多路查找树. 3.定义:m阶B树. (0).根节点孩子数rootChildNum范围:若没有孩子节点则孩子数为0,若有孩子则 ...

  2. Bootstrap table后端分页(ssm版)

    说明bootstrap table可以前端分页,也可以后端sql用limit分页.这里讲的是后端分页,即实用limit.性能较好,一般均用这种源码下载地址:https://git.oschina.ne ...

  3. VS2010/MFC编程入门之十七(对话框:文件对话框)

    上一讲鸡啄米介绍的是消息对话框,本节讲解文件对话框.文件对话框也是很常用的一类对话框. 文件对话框的分类       文件对话框分为打开文件对话框和保存文件对话框,相信大家在Windows系统中经常见 ...

  4. Flask添加翻页功能(非sqlalchemy)

    最近做flask的项目,需要增加翻页的功能,网上找的教程都是结合sqlalchemy的,可是我用的不是sqlalchemy,肿木办呢? 以下是我的做法 一.前端 1.传递页码 前端我使用ajax提交表 ...

  5. CentOS7搭建Gitlab详细过程

    1.参见Gitlab官网说明 原文地址:https://about.gitlab.com/install/#centos-7   1.安装并配置必要的依赖项 在CentOS 7(和RedHat / O ...

  6. Buffer flip()方法

    英文API:Flips this buffer. The limit is set to the current position and then the position is set to ze ...

  7. STM32示波器 信号发生器

    源: STM32示波器 信号发生器

  8. cygwin安装方法

    一.环境 OS:windows 二.安装cygwin以及各类cygwin下的软件 2.1 从官网http://www.cygwin.com/获取最新的版本 2.2 安装过程如下图

  9. FastCGI介绍及Nginx fastcgi配置优化

    FastCGI介绍 FastCGI是从CGI发展改进而来的.传统CGI接口方式的主要缺点是性能很差,因为每次HTTP服务器遇到动态程序时都需要重新启动脚本解析器来执行解析,然后结果被返回给HTTP服务 ...

  10. UVALive-3989 Ladies' Choice (稳定婚姻问题)

    题目大意:稳定婚姻问题.... 题目分析:模板题. 代码如下: # include<iostream> # include<cstdio> # include<queue ...