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. Java用数据结构解决实现问题之数学问题

    有趣的整数: 完数:如果一个数字恰好等于他的因子之和,就叫做完数,需求是求出10000以内的所有的完数. 解法:1.用n去除以1-n之间的所有的整数,将能整除的被除数保存到一个数组中,作为n的一个因子 ...

  2. 算法第四版 在Linux 中调用Algs4库

    一: 搭建Java 环境   : 确认版本: 1.8及以上 [username:~/] javac -version javac 1.8.0_111 [username:~/] java -versi ...

  3. ZW团队:IN_OUT传播模型简介

    传统媒体,网络媒体的整合推广,我曾经提出过一个:Tn-Out模式 In-Out是NBA的篮球术语,你自己百度下 传统媒体承担"IN"的角色,负责传播的深度和建立公信力 网络媒体充当 ...

  4. AVAudioFoundation(5):音视频导出

    本文转自:AVAudioFoundation(5):音视频导出 | www.samirchen.com 本文主要内容来自 AVFoundation Programming Guide. 要读写音视频数 ...

  5. Django:用户登录实例

    Django:用户登录实例 一.源代码 1,login.html代码(登录界面): <!DOCTYPE html> <html lang="zh-CN"> ...

  6. sqlite3 shell方向键、浏览历史命令不能用的问题

    在sqlite3 shell下,按上下方向键可以浏览历史命令,按左右方向键则可以将光标移动到命令中任意字符位置,从而可以修改错误的语句或误敲的字符.所以方向键是sqlite3 shell下最常用的功能 ...

  7. IDEA类和方法注释模板设置

    在开发中使用idea的注释总结:由于IDEA自带的注释模板不是太好用,所以整理一下适用于自己的模板: 一.首先我们来设置IDEA中类的模板:(IDEA中在创建类时会自动给添加注释) 1.File--& ...

  8. 通用Linux内核优化配置

    通用Linux内核优化配置 针对CentOS6.CentOS7.Redhat6.Redhat7等系统 net.ipv4.ip_forward = net.ipv4.conf. net.ipv4.con ...

  9. 详解KMP算法【转】

    本文转载自:http://www.cnblogs.com/yjiyjige/p/3263858.html KMP算法应该是每一本<数据结构>书都会讲的,算是知名度最高的算法之一了,但很可惜 ...

  10. MySQL事务处理实现方法步骤

    需求说明: 案例背景:银行的转账过程中,发生意外是在所难免.为了避免意外而造成不必要的损失,使用事务处理的方式进行处理: A账户现有余额1000元,向余额为200的B账户进行转账500元.可能由于某原 ...