《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窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- cocos代码研究(16)Widget子类RadioButton学习笔记
理论基础 RadioButton是一种特定类型的两状态按钮,它与复选框相似.它可以 和RadioButtonGroup一起使用,形成一个"组".继承自AbstractCheckBu ...
- 121. Best Time to Buy and Sell Stock(股票最大收益)
Say you have an array for which the ith element is the price of a given stock on day i. If you were ...
- uva1146 2-SAT问题
题意大白书 二分答案,然后对于每个可能的答案,跑一遍2-SAT就好了. #include <iostream> #include <string.h> #include < ...
- 20155331 2016-2017-2 《Java程序设计》第8周学习总结
20155331 2016-2017-2 <Java程序设计>第8周学习总结 教材学习内容总结 NIO与NIO2 NIO使用频道(channel)来衔接数据节点,对数据区的标记提供了cle ...
- 20165207 实验一 Java开发环境的熟悉
20165207 实验一 Java开发环境的熟悉 一.实验报告封面 课程:Java程序设计 班级:1652 姓名:李天林 学号:20165207 实验日期:2018年4月2日 实验序号:一 实验名称: ...
- 【运维技术】Nginx安装教程(yum安装,源码编译)
安装方式 yum直接更新源安装 源码直接编译之后安装 使用yum进行直接安装 Installing a Prebuilt CentOS/RHEL Package from an OS Reposito ...
- 在apache中使用.htaccess文件的注意事项
在apache的配置文件中: <VirtualHost *:80> ServerName tp5.com DocumentRoot d:/wamp/www/tp5.com/public & ...
- godaddy之ssl申请
第一步 执行下面命令生成csr和key文件 openssl req -new -newkey rsa: -nodes -keyout trips.com.key -out trips.com.csr ...
- UVa 11383 少林决胜(二分图最佳完美匹配)
https://vjudge.net/problem/UVA-11383 题意: 给定一个N×N矩阵,每个格子里都有一个正整数W(i,j).你的任务是给每行确定一个整数row(i),每列也确定一个整数 ...
- Windows__书
1.<<Windows 网络与通信程序设计>> (第2版) 2. 3.