《DSP using MATLAB》第2章习题Problem2.1
1、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.1.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);
%% ------------------------------------------------------------------------ n1 = -5; n2 = 15;
n = [n1:n2];
x1 = 3 * impseq(-2,n1,n2) + 2 * impseq(0,n1,n2) - impseq(3,n1,n2) + 5 * impseq(7,n1,n2); figure('NumberTitle', 'off', 'Name', 'Problem 2.1.1')
set(gcf,'Color','white');
stem(n,x1); title('x1 Sequence');
xlabel('$n$', 'interpreter', 'latex', 'fontsize', 15);
ylabel('x1(n)', 'fontsize', 15); grid on;
运行结果:
2、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.1.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);
%% ------------------------------------------------------------------------ n1 = -10; n2 = 10;
n = [n1:n2];
x2 = exp(-5) * impseq(-10,n1,n2) + exp(-4) * impseq(-8,n1,n2) + exp(-3)*impseq(-6,n1,n2);
x2 = x2 + exp(-2)*impseq(-4,n1,n2) + exp(-1)*impseq(-2,n1,n2) + exp(0) * impseq(0,n1,n2);
x2 = x2 + exp(-1)*impseq(2,n1,n2) + exp(-2)*impseq(4,n1,n2) + exp(-3)*impseq(6,n1,n2);
x2 = x2 + exp(-4)*impseq(8,n1,n2) + exp(-5)*impseq(10,n1,n2); figure('NumberTitle', 'off', 'Name', 'Problem 2.1.2')
set(gcf,'Color','white');
stem(n,x2); title('x2 Sequence');
xlabel('n'); ylabel('x2(n)'); grid on;
运行结果:
3、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.1.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);
%% ------------------------------------------------------------------------ n1 = -5; n2 = 25;
n = [n1:n2];
x3 = 10*stepseq(0,n1,n2) + (-5)*stepseq(5,n1,n2) + (-10)*stepseq(10,n1,n2)+ 5*stepseq(15,n1,n2); figure('NumberTitle', 'off', 'Name', 'Problem 2.1.3')
set(gcf,'Color','white');
stem(n,x3); title('x3 Sequence');
xlabel('n'); ylabel('x3(n)'); grid on;
运行结果:
4、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.1.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);
%% ------------------------------------------------------------------------ n1 = -30; n2 = 30;
n = [n1:n2];
x4 = exp(0.1*n) .* stepseq(-20,n1,n2) - exp(0.1*n) .* stepseq(10,n1,n2); figure('NumberTitle', 'off', 'Name', 'Problem 2.1.4')
set(gcf,'Color','white');
stem(n,x4); title('x4 Sequence');
xlabel('n'); ylabel('x4(n)'); grid on;
运行结果:
5、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.1.5 \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);
%% ------------------------------------------------------------------------ n1 = -200; n2 = 200;
n = [n1:n2];
x5 = 5*(cos(0.49*pi*n) + cos(0.51*pi*n)); figure('NumberTitle', 'off', 'Name', 'Problem 2.1.5')
set(gcf,'Color','white');
stem(n,x5); title('x5 Sequence');
xlabel('n'); ylabel('x5(n)'); grid on;
运行结果:
6、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.1.6 \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);
%% ------------------------------------------------------------------------ n1 = -200; n2 = 200;
n = [n1:n2];
x6 = 2 * cos(0.01*pi*n) .* cos(0.5*pi*n); figure('NumberTitle', 'off', 'Name', 'Problem 2.1.6')
set(gcf,'Color','white');
stem(n,x6); title('x6 Sequence');
xlabel('n'); ylabel('x6(n)'); grid on;
运行代码:
7、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.1.7 \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);
%% ------------------------------------------------------------------------ n1 = 0; n2 = 100;
n = [n1:n2];
x7 = exp(-0.05*n) .* sin(0.1*pi*n + pi/3); figure('NumberTitle', 'off', 'Name', 'Problem 2.1.7');
set(gcf,'Color','white');
stem(n,x7); title('x7 Sequence');
xlabel('n'); ylabel('x7(n)'); grid on;
运行结果:
8、代码:
%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.1.8 \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);
%% ------------------------------------------------------------------------ n1 = 0; n2 = 100;
n = [n1:n2];
x8 = exp(0.01*n) .* sin(0.1*pi*n); figure('NumberTitle', 'off', 'Name', 'Problem 2.1.8');
set(gcf,'Color','white');
stem(n,x8); title('x8 Sequence');
xlabel('n'); ylabel('x8(n)'); grid on;
运行结果:
《DSP using MATLAB》第2章习题Problem2.1的更多相关文章
- 《DSP using MATLAB》Problem 6.24
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 3.9
利用的频移性质为: 本习题代码: %% ------------------------------------------------------------------------ %% Outp ...
- 《DSP using MATLAB》Problem 2.18
1.代码: function [y, H] = conv_tp(h, x) % Linear Convolution using Toeplitz Matrix % ----------------- ...
- 《DSP using MATLAB》示例 Example 10.1
坚持到第10章了,继续努力! 代码: %% ------------------------------------------------------------------------ %% Ou ...
- 《DSP using MATLAB》 示例 Example 9.16
代码: %% ------------------------------------------------------------------------ %% Output Info about ...
- 《DSP using MATLAB》示例Example7.25
今天清明放假的第二天,早晨出去吃饭时天气有些阴,十点多开始“清明时节雨纷纷”了. 母亲远在他乡看孙子,挺劳累的.父亲照顾生病的爷爷…… 我打算今天把<DSP using MATLAB>第7 ...
- 《DSP using MATLAB》Problem 9.2
前几天看了看博客,从16年底到现在,3年了,终于看书到第9章了.都怪自己愚钝不堪,唯有吃苦努力,一点一点一页一页慢慢啃了. 代码: %% ------------------------------- ...
- 《DSP using MATLAB》Problem 7.38
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- DSP using MATLAB 随书示例Example2.8
x = [3, 11, 7, 0, -1, 4, 2]; nx = [-3:3]; h = [2, 3, 0, -5, 2, 1]; nh = [-1:4]; [y,ny] = conv_m(x,nx ...
随机推荐
- Java文件IO流的操作总结
Java中的IO操作涉及到的概念及相关类很多,很容易弄混,今天特来整理总结一下,并附上一份完整的文件操作的代码. 概念解析 读和写 流就是管道,向管道里面写数据用输出流:write 从管道里面读数据, ...
- 162. Find Peak Element(二分查找 )
A peak element is an element that is greater than its neighbors. Given an input array where num[i] ...
- Python通用网络爬虫脚本
from sys import argv from os import makedirs,unlink,sep,mkdir from os.path import dirname,exists,isd ...
- HCNP学习笔记之史上最全华为路由器交换机配置命令大合集
先来一张思科和华为命令的对照表: 史上最全华为路由器交换机配置命令大合集,熟练掌握下面的华为路由器交换机配置知识点,你只需花几分钟的时间就能明白华为路由器交换机配置.交换机的配置命令等等. 华为路由器 ...
- Python3.x:open()文件操作
Python3.x:open()文件操作 open/文件操作: #open(路径+文件名,读写模式) #读写模式:r只读,r+读写,w新建(会覆盖原有文件),a追加,b二进制文件.常用模式 f=ope ...
- Ubuntu下的MongoDB GUI 可视化管理工具
目录 1 Robo 3T 2 NoSQLBooster for MongoDB(收费) 3 JetBrains Plugin Repository :: Mongo Plugin Ubuntu下的Mo ...
- linux内核分析第八周-理解进程调度时机跟踪分析进程调度与进程切换的过程
实验原理: 一.调度时机 不同类型的进程有不同的调度需求 第一种分类: I/O-bound 频繁的进行I/O 通常会花费很多时间等待I/O操 ...
- 20145211黄志远《网络对抗》Exp9 Web安全基础实践
20145211黄志远<网络对抗>Exp9 Web安全基础实践 基础问题回答 SQL注入攻击原理,如何防御? SQL注入攻击就是利用输入的机会构造自己期望的请求,比如破坏掉用户名或者密码验 ...
- pycharm 模板添加作者时间信息
在pycharm使用过程中,对于每次新建文件的shebang行和关于代码编写者的一些个人信息快捷填写,使用模板的方式比较方便. 方法如下: 1.打开pycharm,选择File-Settings 2. ...
- SQL 中 not in 查询不到数据问题
在开发的过程中,遇到过not in 始终查询不到数据问题 select * from T_CustomerInfo where CustomerID not in (select CustomerID ...