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. spring-data-jpa 介绍 复杂查询,包括多表关联,分页,排序等

    本篇进行Spring-data-jpa的介绍,几乎涵盖该框架的所有方面,在日常的开发当中,基本上能满足所有需求.这里不讲解JPA和Spring-data-jpa单独使用,所有的内容都是在和Spring ...

  2. Smarty 函数

    html_checkboxes 自定义函数 html_checkboxes 根据给定的数据创建复选按钮组. 该函数可以指定哪些元素被选定. 要么必须指定 values 和 ouput 属性,要么指定 ...

  3. 1 :2 Strust2—Demo

    =============================================================== Demo基础包:

  4. c++第二十四天

    p126~p128: 1.关系运算符作用于算数类型和指针类型. 2.逻辑运算符作用于任意能转换成布尔类型值的类型. 3.以上两种运算的运算对象和运算结果都是右值. 4.逻辑与和逻辑或的运算策略:短路求 ...

  5. 常用php操作redis命令整理(二)哈希类型

    HSET将哈希表key中的域field的值设为value;如果field是哈希表中的一个新建域,并且值设置成功,返回1;如果哈希表中域field已经存在且旧值已被新值覆盖,返回0. <?php ...

  6. CSS3 Flex Box(弹性盒子)

    CSS3 Flex Box(弹性盒子) 一.简介 弹性盒子是 CSS3 的一种新的布局模式. CSS3 弹性盒( Flexible Box 或 flexbox),是一种当页面需要适应不同的屏幕大小以及 ...

  7. linux内核分析第八周-理解进程调度时机跟踪分析进程调度与进程切换的过程

    实验原理: 一.调度时机 不同类型的进程有不同的调度需求 第一种分类:        I/O-bound             频繁的进行I/O            通常会花费很多时间等待I/O操 ...

  8. 解决com.mongodb.MongoException$CursorNotFound: cursor 0 not found on server

    背景 经常需要执行脚本调用Java程序读取mongodb中数据,本来是转为后台进程.偶尔看看日志的简单任务.今天发现程序抛出异常“com.mongodb.MongoException$CursorNo ...

  9. Nginx + LUA下流量拦截算法

    前言 每逢大促必压测,每逢大促必限流,这估计是电商人的常态.每次大促期间,业务流量是平时的几倍十几倍,大促期间大部分业务都会集中在购物车结算,必须限流,才能保证系统不宕机. 限流算法 限流算法一般有三 ...

  10. 支线任务2-Basic Calculator

    问题描述: 题目要求我们实现一个简单的加减计算器,计算一个表达式的值,表达式除了数字之外还可能会含有括号,加减符号以及空格. 思路: 其实看到这个题自然就会想到利用后缀式求表达式值的算法作业题,况且这 ...