生成并用stem函数画出这几个序列。

1、代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.4.1 \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);
%% ------------------------------------------------------------------------ %%
%% x(n)={2,4,-3,1,-5,4,7} -3:3
%% *
%% x1(n) = 2x(n-3) + 3x(n+4) - x(n) x = [2,4,-3,1,-5,4,7]
n = [-3:3] [x11,n11] = sigshift(x,n,3)
[x12,n12] = sigshift(x,n,-4)
[x13,n13] = sigshift(x,n,0);
[x1,n1] = sigadd(2 * x11, n11, 3 * x12, n12);
[x1,n1] = sigadd(x1, n1, -x13, n13) figure
set(gcf,'Color','white');
stem(n,x); title('x(n)');
xlabel('n'); ylabel('x');grid on; figure
set(gcf,'Color','white');
stem(n11,x11); title('x11(n)=x(n-3)');
xlabel('n'); ylabel('x11(n)');grid on; figure
set(gcf,'Color','white');
stem(n12,x12); title('x12 = x(n+4)');
xlabel('n'); ylabel('x11(n)');grid on; figure
set(gcf,'Color','white');
stem(n1,x1); title('x1 = 2x(n-3) + 3x(n+4) -x(n))');
xlabel('n'); ylabel('x1(n)');grid on;

  运行结果:

2、代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.4.2 \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);
%% ------------------------------------------------------------------------ %%
%% x(n)={2,4,-3,1,-5,4,7} -3:3
%% *
%% x2(n) = 4x(4+n) + 5x(n+5) + 2x(n) x = [2,4,-3,1,-5,4,7]
n = [-3:3] [x11,n11] = sigshift(x,n,-4)
[x12,n12] = sigshift(x,n,-5)
[x13,n13] = sigshift(x,n,0);
[x1,n1] = sigadd(4*x11, n11, 5*x12,n12);
[x1,n1] = sigadd(x1,n1,2*x13,n13) figure
set(gcf,'Color','white');
stem(n,x); title('x(n)');
xlabel('n'); ylabel('x');grid on; figure
set(gcf,'Color','white');
stem(n11,x11); title('x11(n)=x(4+n)');
xlabel('n'); ylabel('x11(n)');grid on; figure
set(gcf,'Color','white');
stem(n12,x12); title('x12 = x(n+5)');
xlabel('n'); ylabel('x11(n)');grid on; figure
set(gcf,'Color','white');
stem(n1,x1); title('x1 = 4x(4+n) + 5x(n+5) +2x(n))');
xlabel('n'); ylabel('x1(n)');grid on;

  运行结果:

3、代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.4.3 \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);
%% ------------------------------------------------------------------------ %%
%% x(n)={2,4,-3,1,-5,4,7} -3:3
%% *
%% x3(n) = x(n+3)x(n-2) + x(1-n)x(n+1) n = [-3:3];
x = [2,4,-3,1,-5,4,7]; [x11,n11] = sigshift(x,n,-3); [x12,n12] = sigshift(x,n,2);
[x13,n13] = sigfold(x,n); [x13,n13] = sigshift(x13,n13,1);
[x14,n14] = sigshift(x,n,-1); [x21,n21] = sigmult(x11, n11, x12,n12);
[x22,n22] = sigmult(x13, n13, x14,n14); [x3,n3] = sigadd(x21,n21,x22,n22); figure
set(gcf,'Color','white');
subplot(3,1,1); stem(n,x); title('x(n)'); xlabel('n'); ylabel('x');grid on;
subplot(3,1,2); stem(n11,x11);title('x(n+3)');xlabel('n'); ylabel('x');grid on;
subplot(3,1,3); stem(n12,x12);title('x(n-2)');xlabel('n'); ylabel('x');grid on; figure
set(gcf,'Color','white');
subplot(3,1,1); stem(n,x); title('x(n)'); xlabel('n'); ylabel('x');grid on;
subplot(3,1,2); stem(n13,x13);title('x(1-n)');xlabel('n'); ylabel('x');grid on;
subplot(3,1,3); stem(n14,x14);title('x(n+1)');xlabel('n'); ylabel('x');grid on; figure
set(gcf,'Color','white');
subplot(2,1,1); stem(n21,x21);title('x(n+3)x(n-2)');xlabel('n'); ylabel('x');grid on;
subplot(2,1,2); stem(n12,x12); title('x12 = x(n+5)');title('x(n+3)');xlabel('n'); ylabel('x');grid on; xlabel('n'); ylabel('x11(n)');grid on; figure
set(gcf,'Color','white');
stem(n3,x3); title('x1 = 4x(4+n) + 5x(n+5) +2x(n))');
xlabel('n'); ylabel('x1(n)');grid on;

  运行结果:

4、代码:

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.4.4 \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);
%% ------------------------------------------------------------------------ %%
%% x(n)={2,4,-3,1,-5,4,7} -3:3
%% *
%% x4(n) = 2exp(0.5n)x(n) + cos(0.1pi*n)x(n+2) n = [-10:10];
x = [zeros(1, 7), 2, 4, -3, 1, -5, 4, 7, zeros(1,7)]; x11 = exp(0.5*n);
x12 = cos(0.1*pi*n);
[x13,n13] = sigshift(x,n,-2); [x21,n21] = sigmult(2*x11, n, x, n);
[x22,n22] = sigmult(x12, n, x13, n13); [x4,n4] = sigadd(x21, n21, x22, n22); %x4 = 2*exp(0.5*n)*x(n) + cos(0.1*pi*n)*x11(n11);
figure
set(gcf,'Color','white');
subplot(3,1,1); stem(n, x); title('x(n)'); xlabel('n'); ylabel('x');grid on;
subplot(3,1,2); stem(n, x11);title('exp(0.5n)'); xlabel('n'); ylabel('x');grid on;
subplot(3,1,3); stem(n, x12);title('cos(0.1\pin)');xlabel('n'); ylabel('x');grid on; figure
set(gcf,'Color','white');
subplot(3,1,1); stem(n,x); title('x(n)'); xlabel('n'); ylabel('x');grid on;
subplot(3,1,2); stem(n21, x21);title('2exp(0.5n)*x(n)'); xlabel('n'); ylabel('x');grid on;
subplot(3,1,3); stem(n22, x22);title('cos(0.1\pin)*x(n+2)');xlabel('n'); ylabel('x');grid on; figure
set(gcf,'Color','white');
stem(n4,x4); title('x4(n) = 2exp(0.5n)x(n) + cos(0.1pi*n)x(n+2)');
xlabel('n'); ylabel('x4(n)');grid on;

  运行结果:

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

  1. 《DSP using MATLAB》Problem 7.27

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

  2. 《DSP using MATLAB》Problem 7.26

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

  3. 《DSP using MATLAB》Problem 7.25

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

  4. 《DSP using MATLAB》Problem 7.24

    又到清明时节,…… 注意:带阻滤波器不能用第2类线性相位滤波器实现,我们采用第1类,长度为基数,选M=61 代码: %% +++++++++++++++++++++++++++++++++++++++ ...

  5. 《DSP using MATLAB》Problem 7.23

    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...

  6. 《DSP using MATLAB》Problem 7.16

    使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

  7. 《DSP using MATLAB》Problem 7.15

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

  8. 《DSP using MATLAB》Problem 7.14

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

  9. 《DSP using MATLAB》Problem 7.13

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

  10. 《DSP using MATLAB》Problem 7.12

    阻带衰减50dB,我们选Hamming窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

随机推荐

  1. poj1177 Picture 矩形周长并

    地址:http://poj.org/problem?id=1177 题目: Picture Time Limit: 2000MS   Memory Limit: 10000K Total Submis ...

  2. hdu5057 分块处理,当数值大于数据范围时树状数组 真是巧 将大数据分为小数据来处理

    这题说的给了100000个数有100000次操作 询问 L和R 区间内 在D位上为P的个数,用树状数组存 要开[10][10][100000]的int 开不了但是能开 这么大的unsign short ...

  3. springcloud18---springCloudConfig

    package com.itmuch.cloud; import org.springframework.beans.factory.annotation.Value; import org.spri ...

  4. MVC相关资料收集

    文章: 谈谈service层在mvc框架中的意义和职责 Model–view–controller - Wikipedia MVC Architecture - Google Chrome - Chr ...

  5. 结合grabcut和inpaint,实现人像去除

    在OpenCV提供更多函数中,grabcut能够实现抠图,inpaint能够实现修补.那么把两者结合起来,就能够实现简单的“人像去除”功能,也就是框选一个人后,使用周围的景象对人像进行修补.虽然效果比 ...

  6. 20145211MSF基础应用实验

    20145211MSF基础应用实验 一.实验博客 ms08_067攻击实验 http://www.cnblogs.com/entropy/p/6690301.html ms12_004漏洞攻击 htt ...

  7. ifconfig源码分析之与内核交互数据

    <ifconfig源码分析之与内核交互数据>本文档的Copyleft归rosetta所有,使用GPL发布,可以自由拷贝.转载,转载时请保持文档的完整性.参考资料:<Linux设备驱动 ...

  8. zabbix负载均衡群集高可用架构

    由于服务器资源限制,将MySQL服务放在zabbix服务器上,生产环境应尽量分开

  9. sqlmap简单使用方法

    sqlmap使用 注入点   http://1xx.xxx.xxx.xxxx/dvwa/vulnerabilities/sqli/index.php?id=1&Submit=Submit# 通 ...

  10. ccf 行车路线

    问题描述 小明和小芳出去乡村玩,小明负责开车,小芳来导航. 小芳将可能的道路分为大道和小道.大道比较好走,每走1公里小明会增加1的疲劳度.小道不好走,如果连续走小道,小明的疲劳值会快速增加,连续走s公 ...