《DSP using MATLAB》 Problem 2.3
本题主要是显示周期序列的。
1、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.3.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);
%% ------------------------------------------------------------------------ %%
%% {...,-2,-1,0,1,2,...}
%% *
%% Plot 5 periods
self_length = 5;
periods = 5; n = [-2:(2+(periods-1) * self_length)];x = [-2,-1,0,1,2];
xtilde = x' * ones(1,periods); xtilde = (xtilde(:))'; figure('NumberTitle', 'off', 'Name', 'Problem 2.3.1');
set(gcf,'Color','white');
stem(n,xtilde); title('Sequence in Problem 2.3.1');
xlabel('n'); ylabel('xtilde(n)');grid on;
显示结果:
2、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.3.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);
%% ------------------------------------------------------------------------ %%
%% exp(0.1n)[ u(n) - u(n-20)] 0-20 valid
%%
%% Plot 3 periods [0;3*20-1] [0,59] n = [0:20]; % We can get self_periods=21 from here
x = exp(0.1*n) .* (stepseq(0,0,20) - stepseq(20,0,20));
%x = (stepseq(0,0,20) - stepseq(20,0,20)); figure('NumberTitle', 'off', 'Name', 'Problem 2.3.2 x(n)');
set(gcf,'Color','white');
stem(n,x); title('x(n) Sequence');
xlabel('n'); ylabel('x(n)');grid on; self_length = 21;
periods = 3;
n1 = [0:20 + (periods-1) * self_length]; xtilde = x' * ones(1,periods); xtilde = (xtilde(:))'; figure('NumberTitle', 'off', 'Name', 'Problem 2.3.2');
set(gcf,'Color','white');
stem(n1,xtilde); title('Sequence in Problem 2.3.2');
xlabel('n'); ylabel('xtilde(n)');grid on;
运行结果:
3、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.3.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);
%% ------------------------------------------------------------------------ %%
%% sin(0.1*pi*n)[ u(n) - u(n-10)] 0-10 valid
%%
%% Plot 4 periods n = [0:10]; % We can get self_periods=11 from here
x = sin(0.1*pi*n) .* (stepseq(0,0,10) - stepseq(10,0,10)); figure('NumberTitle', 'off', 'Name', 'Problem 2.3.3 x(n)');
set(gcf,'Color','white');
stem(n,x); title('x(n) Sequence');
xlabel('n'); ylabel('x(n)');grid on; self_length = 11;
periods = 4;
n1 = [0:10 + (periods-1) * self_length]; xtilde = x' * ones(1,periods); xtilde = (xtilde(:))'; figure('NumberTitle', 'off', 'Name', 'Problem 2.3.3');
set(gcf,'Color','white');
stem(n1,xtilde); title('Sequence in Problem 2.3.3');
xlabel('n'); ylabel('xtilde(n)');grid on;
运行结果:
4、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.3.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);
%% ------------------------------------------------------------------------ %%
%% {...,1,2,3,...} + {...,1,2,3,4,...} n=[0:24]
%% * *
%% what is the periods self_length1 = 3;
periods1 = 8; n1 = [0:(2+(periods1-1) * self_length1)];
x1 = [1, 2, 3];
xtilde1 = x1' * ones(1,periods1); xtilde1 = (xtilde1(:))'; figure('NumberTitle', 'off', 'Name', 'Problem 2.3.4 Period Seq 1');
set(gcf,'Color','white');
stem(n1,xtilde1); title('Sequence {...,1,2,3,...}');
xlabel('n'); ylabel('xtilde1(n)');grid on; self_length2 = 4;
periods2 = 6; n2 = [0:(3+(periods2-1) * self_length2)];
x2 = [1, 2, 3, 4];
xtilde2 = x2' * ones(1,periods2); xtilde2 = (xtilde2(:))'; figure('NumberTitle', 'off', 'Name', 'Problem 2.3.4 Period Seq 2');
set(gcf,'Color','white');
stem(n2,xtilde2); title('Sequence {...,1,2,3,4,...}');
xlabel('n'); ylabel('xtilde2(n)');grid on; x = xtilde1 + xtilde2
%[x,n] = sigadd(xtilde1,24,xtilde2,24); figure('NumberTitle', 'off', 'Name', 'Problem 2.3.4');
set(gcf,'Color','white');
stem(x); title('Sequence {...,1,2,3,...} + {...,1,2,3,4,...}');
xlabel('n'); ylabel('x(n)');grid on;
运行结果:
《DSP using MATLAB》 Problem 2.3的更多相关文章
- 《DSP using MATLAB》Problem 7.27
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.26
注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.25
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.24
又到清明时节,…… 注意:带阻滤波器不能用第2类线性相位滤波器实现,我们采用第1类,长度为基数,选M=61 代码: %% +++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.23
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...
- 《DSP using MATLAB》Problem 7.16
使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.15
用Kaiser窗方法设计一个台阶状滤波器. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.14
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.13
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.12
阻带衰减50dB,我们选Hamming窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- (14)如何使用Cocos2d-x 3.0制作基于tilemap的游戏:第二部分
引言 程序截图: 这篇教程是<如何使用Cocos2d-x 3.0制作基于tilemap的游戏>的第二部分.在上一个教程中,我们创建了一个简单的基于tiled地图的游戏,里面有一个忍者在沙漠 ...
- facebook graph api 报错SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)')
使用facebook graph api,报错如下 一开始以为是https证书验证失败,查了一下午源码,没有看到问题,于是把Python27\lib\site-packages\requests\ad ...
- Android 多媒体MediaPlayer使用详解
现在的手机功能越来越丰富了,遥想10年前,MP3,MP4,MP5,还是很流行的,博主当时读高中时很想拥有一台,可以听音乐和看电影.可是条件有限,学校也禁止此东西,所以只能偷偷的玩.而现在我们的手机也很 ...
- 大数据领域两大最主流集群管理工具Ambari和Cloudera Manger
不多说,直接上干货! 目前啊,都知道,大数据集群管理方式分为手工方式(Apache hadoop)和工具方式(Ambari + hdp 和Cloudera Manger + CDH). 手工部署呢, ...
- poj3421 X-factor Chains(重复元素的全排列)
poj3421 X-factor Chains 题意:给定正整数$x(x<=2^{20})$,求$x$的因子组成的满足任意前一项都能整除后一项的序列的最大长度,以及满足最大长度的子序列的个数. ...
- ZLYD团队第一周项目总结
ZLYD团队第一周项目总结 团队项目 项目内容:我们打算利用Applet实现一个吃豆子游戏,团队初步设定游戏规则如下: 按空格键,游戏开始: 通过方向键控制吃豆者的运动方向,直到吃光所有金豆子: 吃到 ...
- [SpringBoot] - 了解什么是SpringBoot,使用SpringBoot的配置文件
首先明白Spring是什么,Spring是Java开发的一个框架,为了方便简化Java开发. 什么是注解(注解式开发)? Spring的常用注解有哪些? 假如用SpringBoot构建一个网站程序,应 ...
- G_M_网络流A_网络吞吐量
调了两天的代码,到最后绝望地把I64d改成lld就过了,我真的是醉了. 网络吞吐量 题面:给出一张(n个点,m条边)带权(点权边权均有)无向图,点权为每个点每秒可以接受发送的最大值,边权为花费,保证数 ...
- SDN前瞻 软件定义网络的一些概念
SDN的核心:可编程性 SDN的思想:SOA面向服务 面向服务的体系结构(service-oriented architecture SOA) 使网络连接的大量计算机易于合作,以 服务 而不是人工交互 ...
- [笔记] SQL性能优化 - 常用语句(一)
第一步 DBCC DROPCLEANBUFFERS 清除缓冲区 DBCC FREEPROCCACHE 删除计划高速缓存中的元素 从缓冲池中删除所有清除缓冲区.要求具有 sysadmin 固定服务器角色 ...