1、代码

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.6.1 \n\n'); [v, d] = version;
fprintf(' MATLAB Version: %20s\n\n', v);
fprintf(' Released Date: %17s\n\n', d); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Today is %7s, and Now is %20s \n\n', wkd2, time_stamp);
%% ------------------------------------------------------------------------ n = [0:9];
%x = stepseq(0,0,10) - stepseq(10,0,10);
x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
[xe,xo,m] = evenodd(x,n); figure('NumberTitle', 'off', 'Name', 'Problem 2.6')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色
stem(n,x); title('x sequence ');
xlabel('n'); ylabel('x(n)') ;
% axis([-10,10,0,1.2])
grid on figure('NumberTitle', 'off', 'Name', 'Problem 2.6')
set(gcf,'Color',[1,1,1])
stem(m,xe); title('Even Part');
xlabel('n'); ylabel('xe(n)');
%axis([-10,10,0,1.2])
grid on figure('NumberTitle', 'off', 'Name', 'Problem 2.6')
set(gcf,'Color','white')
stem(m,xo); title('Odd Part');
xlabel('n'); ylabel('xo(n)');
%axis([-10,10,-0.6,0.6])
grid on

  运行结果:

2、代码

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.6.2 \n\n'); [v, d] = version;
fprintf(' MATLAB Version: %20s\n\n', v);
fprintf(' Released Date: %17s\n\n', d); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Today is %7s, and Now is %20s \n\n', wkd2, time_stamp);
%% ------------------------------------------------------------------------ n = [-5:10];
x = exp(0.1 * n) .* (stepseq(-5,-5,10) - stepseq(10,-5,10)); [xe,xo,m] = evenodd(x,n); figure('NumberTitle', 'off', 'Name', 'Problem 2.6')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色
stem(n,x); title('x sequence ');
xlabel('n'); ylabel('x(n)') ;
% axis([-10,10,0,1.2])
grid on figure('NumberTitle', 'off', 'Name', 'Problem 2.6')
set(gcf,'Color',[1,1,1])
stem(m,xe); title('Even Part');
xlabel('n'); ylabel('xe(n)');
%axis([-10,10,0,1.2])
grid on figure('NumberTitle', 'off', 'Name', 'Problem 2.6')
set(gcf,'Color','white')
stem(m,xo); title('Odd Part');
xlabel('n'); ylabel('xo(n)');
%axis([-10,10,-0.6,0.6])
grid on

  运行结果:

3、代码

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.6.3 \n\n'); [v, d] = version;
fprintf(' MATLAB Version: %20s\n\n', v);
fprintf(' Released Date: %17s\n\n', d); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Today is %7s, and Now is %20s \n\n', wkd2, time_stamp);
%% ------------------------------------------------------------------------ n = [-20:20];
x = cos(0.2 * pi * n + pi/4); [xe,xo,m] = evenodd(x,n); figure('NumberTitle', 'off', 'Name', 'Problem 2.6')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色
stem(n,x); title('x sequence ');
xlabel('n'); ylabel('x(n)') ;
% axis([-10,10,0,1.2])
grid on figure('NumberTitle', 'off', 'Name', 'Problem 2.6')
set(gcf,'Color',[1,1,1])
stem(m,xe); title('Even Part');
xlabel('n'); ylabel('xe(n)');
%axis([-10,10,0,1.2])
grid on figure('NumberTitle', 'off', 'Name', 'Problem 2.6')
set(gcf,'Color','white')
stem(m,xo); title('Odd Part');
xlabel('n'); ylabel('xo(n)');
%axis([-10,10,-0.6,0.6])
grid on

  运行结果:

4、代码

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.6.4 \n\n'); [v, d] = version;
fprintf(' MATLAB Version: %20s\n\n', v);
fprintf(' Released Date: %17s\n\n', d); time_stamp = datestr(now, 31);
[wkd1, wkd2] = weekday(today, 'long');
fprintf(' Today is %7s, and Now is %20s \n\n', wkd2, time_stamp);
%% ------------------------------------------------------------------------ n = [0:100];
x = exp(-0.05 * n) .* sin(0.1 * pi * n + pi/3); [xe,xo,m] = evenodd(x,n); figure('NumberTitle', 'off', 'Name', 'Problem 2.6')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色
stem(n,x); title('x sequence ');
xlabel('n'); ylabel('x(n)') ;
% axis([-10,10,0,1.2])
grid on figure('NumberTitle', 'off', 'Name', 'Problem 2.6')
set(gcf,'Color',[1,1,1])
stem(m,xe); title('Even Part');
xlabel('n'); ylabel('xe(n)');
%axis([-10,10,0,1.2])
grid on figure('NumberTitle', 'off', 'Name', 'Problem 2.6')
set(gcf,'Color','white')
stem(m,xo); title('Odd Part');
xlabel('n'); ylabel('xo(n)');
%axis([-10,10,-0.6,0.6])
grid on

  运行结果:

《DSP using MATLAB》Problem 2.6的更多相关文章

  1. 《DSP using MATLAB》Problem 7.27

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

  2. 《DSP using MATLAB》Problem 7.26

    注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...

  3. 《DSP using MATLAB》Problem 7.25

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

  4. 《DSP using MATLAB》Problem 7.24

    又到清明时节,…… 注意:带阻滤波器不能用第2类线性相位滤波器实现,我们采用第1类,长度为基数,选M=61 代码: %% +++++++++++++++++++++++++++++++++++++++ ...

  5. 《DSP using MATLAB》Problem 7.23

    %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...

  6. 《DSP using MATLAB》Problem 7.16

    使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

  7. 《DSP using MATLAB》Problem 7.15

    用Kaiser窗方法设计一个台阶状滤波器. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

  8. 《DSP using MATLAB》Problem 7.14

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

  9. 《DSP using MATLAB》Problem 7.13

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

  10. 《DSP using MATLAB》Problem 7.12

    阻带衰减50dB,我们选Hamming窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...

随机推荐

  1. ASP.NET 无法生成临时类(result=1)图解

    说明: 执行当前 Web 请求期间,出现未处理的异常.请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息. 异常详细信息: System.InvalidOperationExcep ...

  2. VS2010/MFC编程入门之二十六(常用控件:滚动条控件Scroll Bar)

    回顾上一节,鸡啄米讲的是组合框控件Combo Box的使用.本节详解滚动条控件Scroll Bar的相关内容. 滚动条控件简介 滚动条大家也很熟悉了,Windows窗口中很多都有滚动条.前面讲的列表框 ...

  3. 2018 Multi-University Training Contest 3 Solution

    A - Problem A. Ascending Rating 题意:给出n个数,给出区间长度m.对于每个区间,初始值的max为0,cnt为0.遇到一个a[i] > ans, 更新ans并且cn ...

  4. 2016 CCPC 长春 Solution

    A - Hanzo vs. Genji 留坑. B - Fraction 水. #include <bits/stdc++.h> using namespace std; inline i ...

  5. i春秋之荒岛求生write-up

    i春秋之荒岛求生write-up 第一关 这一关的答案是在题目的最后一句加粗的 躺平等死 和 勇敢战斗 中进行选择,结合前文中提到的 如果你想出去,就必须打败他们 自然得出答案是 勇敢战斗 . 第二关 ...

  6. Linux内核分析 03

    一,构造一个简单的Linux系统MenuOS 1.Linux内核源代码简介 回顾一下前面的三大法宝和两把宝剑. arch/x86目录下的代码需要重点关注 阅读代码的时候把除了x86以外的都删掉会有利于 ...

  7. 20155201 2016-2017-2 《Java程序设计》第三周学习总结

    20155201 2016-2017-2 <Java程序设计>第三周学习总结 教材学习内容总结 - 第四章要点: 4.1类与对象 类定义时使用class关键词,基本模式为 class na ...

  8. InstallShield的工程类型的选择

    转载:http://blog.csdn.net/wuxiaoqrs/article/details/45717695 InstallScript vs. Basic MSI InstallScript ...

  9. Java静态内存与动态内存分配的解析

    1. 静态内存 静态内存是指在程序开始运行时由编译器分配的内存,它的分配是在程序开始编译时完成的,不占用CPU资源. 程序中的各种变量,在编译时系统已经为其分配了所需的内存空间,当该变量在作用域内使用 ...

  10. luogu P1029 最大公约数和最小公倍数问题

    https://www.luogu.org/problem/show?pid=1029 输入二个正整数x0,y0(2<=x0<100000,2<=y0<=1000000),求出 ...