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. SQL Server 一些使用小技巧

    1.查询的时候把某一个字段的值拼接成字符串 以下是演示数据. 第一种方式:使用自定义变量 ) SET @Names='' -- 需要先赋值为空字符串,不然结果会是 null SELECT @Names ...

  2. Redis在Linux下的安装与配置

    Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API. Redis是 NoSQL技术阵营中的一员. 说到NoSQL, ...

  3. CyclicBarrier实现流水处理服务类

    package com.yzu.zhang.thread.concurrent; import java.util.Map.Entry; import java.util.Random; import ...

  4. WebCollector2.7爬虫框架——在Eclipse项目中配置

    WebCollector2.7爬虫框架——在Eclipse项目中配置 在Eclipse项目中使用WebCollector爬虫非常简单,不需要任何其他的配置,只需要导入相关的jar包即可. Netbea ...

  5. git commit的规范

    https://www.yuque.com/fe9/basic/nruxq8#6c228def 制定一个 git commit 信息的提交规范是开发团队工作流必不可少的环节.试想一下,如果查看主分支上 ...

  6. IAsyncResult接口

    #region 程序集 mscorlib.dll, v4.0.0.0 // C:\Program Files (x86)\Reference Assemblies\Microsoft\Framewor ...

  7. Python学习札记(二十二) 函数式编程3 filter & SyntaxError: unexpected EOF while parsing

    参考: filter Problem SyntaxError: unexpected EOF while parsing 遇到该语法错误,一般是由于 括号不匹配 问题. Note 1.filter 用 ...

  8. POJ 3281 Dining(最大流)

    http://poj.org/problem?id=3281 题意: 有n头牛,F种食物和D种饮料,每头牛都有自己喜欢的食物和饮料,每种食物和饮料只能给一头牛,每头牛需要1食物和1饮料.问最多能满足几 ...

  9. 使用 shinydashboard

    除了 shiny 扩展包提供的函数之外,RStudio 也开发了一个 shinydashboard 扩展包 (http://rstudio.github.io/shinydashboard/),它呈现 ...

  10. QtWebKit_cookie

    1.百度搜索“qtwebkit cookie” 2. 2.1.qtwebkit 里 cookie 信息的保存 http://blog.tianya.cn/post-227188-33378112-1. ...