代码:

%% ------------------------------------------------------------------------
%% 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. 35. Search Insert Position(二分查找)

    Given a sorted array and a target value, return the index if the target is found. If not, return the ...

  2. vgg_face人脸识别

    最近参考http://blog.csdn.net/hlx371240/article/details/51388022一文,用LFW数据集对vgg_face.caffemodel进行fine-tune ...

  3. 前端面试题之 sum(2)(3) (链式调用,toString,柯里化,数组操作)

    写一个函数让下面两个输出结果相同:console.log(sum(2)(3));console.log(sum(2,3)); var sum = (function() { var list = [] ...

  4. Thinkphp在Lnmp环境下部署项目先后报错问题解决:_STORAGE_WRITE_ERROR_:./Application/Runtime/Cache/Home/...Access denied.

    首先报错:_STORAGE_WRITE_ERROR_:./Application/Runtime/Cache/Home/769e70f2e46f34ceb60619bbda5e4691.php 解决此 ...

  5. bzoj1297 / P4159 [SCOI2009]迷路

    P4159 [SCOI2009]迷路 如果边权只有 0/1 那么不就是一个灰常简单的矩阵快速幂吗! 然鹅边权 $<=9$ 所以我们把每个点拆成9个点! 解决~ #include<iostr ...

  6. spring Boot加载bean

    1.SpringBoot中加载bean,可以使用注解@compenent直接加载到applicationContext容器中 2.在直接类@Configuration中,手动注册bean,如:

  7. Matlab绘图基础——用print函数批量保存图片到文件(Print figure or save to file)

    一.用法解析 1.1. 分辨率-rnumber 1.2.  输出图片的“格式”formats 二.用法示例 2.1. 设置输出图片的“图像纵横比” 2.2. Batch Processing(图片保存 ...

  8. Linux 用户和组的 添加/删除

    1.建用户:adduser phpq //新建phpq用户passwd phpq //给phpq用户设置密码 2.建工作组groupadd test //新建test工作组 3.新建用户同时增加工作组 ...

  9. Bridge(桥接)

    意图: 将抽象部分与它的实现部分分离,使它们都可以独立地变化. 适用性: 你不希望在抽象和它的实现部分之间有一个固定的绑定关系.例如这种情况可能是因为,在程序运行时刻实现部分应可以被选择或者切换. 类 ...

  10. 何时使用MQ ?

    何时使用MQmq作为一种基础中间件在互联网项目中有着大量的使用. 一种技术的产生自然是为了解决某种需求,通常来说是以下场景: 需要跨进程通信:B系统需要A系统的输出作为输入参数.当A系统的输出能力远远 ...