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的更多相关文章

  1. 《DSP using MATLAB》Problem 6.24

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

  2. 《DSP using MATLAB》Problem 3.9

    利用的频移性质为: 本习题代码: %% ------------------------------------------------------------------------ %% Outp ...

  3. 《DSP using MATLAB》Problem 2.18

    1.代码: function [y, H] = conv_tp(h, x) % Linear Convolution using Toeplitz Matrix % ----------------- ...

  4. 《DSP using MATLAB》示例 Example 10.1

    坚持到第10章了,继续努力! 代码: %% ------------------------------------------------------------------------ %% Ou ...

  5. 《DSP using MATLAB》 示例 Example 9.16

    代码: %% ------------------------------------------------------------------------ %% Output Info about ...

  6. 《DSP using MATLAB》示例Example7.25

    今天清明放假的第二天,早晨出去吃饭时天气有些阴,十点多开始“清明时节雨纷纷”了. 母亲远在他乡看孙子,挺劳累的.父亲照顾生病的爷爷…… 我打算今天把<DSP using MATLAB>第7 ...

  7. 《DSP using MATLAB》Problem 9.2

    前几天看了看博客,从16年底到现在,3年了,终于看书到第9章了.都怪自己愚钝不堪,唯有吃苦努力,一点一点一页一页慢慢啃了. 代码: %% ------------------------------- ...

  8. 《DSP using MATLAB》Problem 7.38

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

  9. 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 ...

随机推荐

  1. 关于Oracle误操作--数据被Commit后的数据回退恢复(闪回)

    今天操作Oracle数据库时,做一个Update数据时,不小心少写了个where,看这粗心大意的. 于是乎,把所有的员工工号都给更新成一个同一个工号了.这是一个悲催的故事. 因为工号是Check了好多 ...

  2. hdu5072 容斥+枚举

    这题说的是给了 n 个数字 每个数值大于1 小于100000,n小于100000 ,找出满足下面要求的三人组有多少种 比如abc ( (ab)==(bc)==(ac) ==1 )||( (ab)!=1 ...

  3. 【4】Python对象

    本章主题 Python对象 内建类型 标准类型操作符 值的比较 对象身份比较 布尔类型 标准类型内建函数 标准类型总览 各种类型 不支持的类型     Python对象        Python使用 ...

  4. java switch参数类型

    switch: switch语句是根据选择因子实现多路选择(也就是说从一系列执行路径中挑选一个)的一种干净利落的方法. 1.java5之前: switch只能使用能自动转化为int类型的参数:byte ...

  5. Vue学习笔记之Vue学习前的准备工作

    0x00 起步 1.扎实的HTML/CSS/Javascript基本功,这是前置条件. 2.不要用任何的构建项目工具,只用最简单的<script>,把教程里的例子模仿一遍,理解用法.不推荐 ...

  6. caffe2 环境的搭建以及detectron的配置

    caffe2 环境的搭建以及detectron的配置 建议大家看一下这篇博客https://tech.amikelive.com/node-706/comprehensive-guide-instal ...

  7. Python学习札记(二十九) 模块2

    参考:使用模块 NOTE 1.内建sys模块: #!/usr/bin/env python3 import sys 'a test module' __author__ = 'wasdns' def ...

  8. UVa 10534 波浪子序列(快速求LIS)

    https://vjudge.net/problem/UVA-10534 题意:给定一个长度为n的整数序列,求一个最长子序列(不一定连续),使得该序列的长度为2k+1,前k+1个数严格递增,后k+1个 ...

  9. install ros-indigo-camera-info-manager

    CMake Warning at /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake: (find_package): Could not fi ...

  10. 100W数据,测试复合索引

    复合索引不是那么容易被catch到的. 两个查询条件都是等于的时候,才会被catch到. mysql> select count(*) from tf_user_index where sex ...