1、代码:

function [xe,xo,m] = evenodd_cv(x,n)
%
% Complex signal decomposition into even and odd parts
% ----------------------------------------------------
% [xe,xo,m] = evenodd_cv(x,n)
%
%
%if any(imag(x) = 0)
% error('x is a real sequence');
%end m = -fliplr(n);
m1 = min([m,n]); m2 = max([m,n]); m = m1:m2; nm = n(1)-m(1); n1 = 1:length(n); x1 = zeros(1,length(m)); x1(n1+nm) = x; x = x1; xe = 0.5*(x + conj(fliplr(x))); xo = 0.5*(x - conj(fliplr(x)));

2、代码

%% ------------------------------------------------------------------------
%% Output Info about this m-file
fprintf('\n***********************************************************\n');
fprintf(' <DSP using MATLAB> Problem 2.7.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 = [0:10];
x = 10 * exp( (-0.1+j*0.2*pi) * n ); [xe,xo,m] = evenodd_cv(x,n); figure('NumberTitle', 'off', 'Name', 'Problem 2.7 x(n)')
set(gcf,'Color',[1,1,1]) % 改变坐标外围背景颜色
subplot(2,1,1); stem(n, real(x)); title('x sequence Real Part');
xlabel('n'); ylabel('Real[x(n)]') ;
% axis([-10,10,0,1.2])
grid on
subplot(2,1,2); stem(n, imag(x)); title('x sequence Imag Part');
xlabel('n'); ylabel('Imag[x(n)]');
grid on; figure('NumberTitle', 'off', 'Name', 'Problem 2.7 xe(m)')
set(gcf,'Color',[1,1,1])
subplot(2,1,1); stem(m,real(xe)); title('Real Part of Even Sequence');
xlabel('m'); ylabel('Real[xe(m)]');
%axis([-10,10,0,1.2])
grid on
subplot(2,1,2); stem(m,imag(xe)); title('Imag Part of Even Sequence');
xlabel('m'); ylabel('Imag[xe(m)]');
%axis([-10,10,0,1.2])
grid on figure('NumberTitle', 'off', 'Name', 'Problem 2.7 xo(m)')
set(gcf,'Color','white')
subplot(2,1,1); stem(m,real(xo)); title('Real Part of Odd Sequence');
xlabel('m'); ylabel('Real[xo(m)]');
%axis([-10,10,0,1.2])
grid on
subplot(2,1,2); stem(m,imag(xo)); title('Imag Part of Odd Sequence');
xlabel('m'); ylabel('Imag[xo(m)]');
%axis([-10,10,0,1.2])
grid on % -----------------------------------------
% xe(-m)
% -----------------------------------------
figure('NumberTitle', 'off', 'Name', 'Problem 2.7 xe(-m)')
set(gcf,'Color',[1,1,1])
subplot(2,1,1); stem(m,real(fliplr(xe))); title('Real Part of xe(-m)');
xlabel('m'); ylabel('Real[xe(-m)]');
%axis([-10,10,0,1.2])
grid on
subplot(2,1,2); stem(m,imag(fliplr(xe))); title('Imag Part of xe(-m)');
xlabel('m'); ylabel('Imag[xe(-m)]');
%axis([-10,10,0,1.2])
grid on % ------------------------------------------------------
% xo(-m)
% ------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'Problem 2.7 xo(-m)')
set(gcf,'Color',[1,1,1])
subplot(2,1,1); stem(m,real(fliplr(xo))); title('Real Part of xo(-m)');
xlabel('m'); ylabel('Real[xo(-m)]');
grid on
subplot(2,1,2); stem(m,imag(fliplr(xo))); title('Imag Part of xo(-m)');
xlabel('m'); ylabel('Imag[xo(-m)]');
grid on

  运行结果:

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

  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. .NET 海量数据处理,并处理事务问题

    1.下面是一个C#的控制台以代码来说明处理 using System.Data.SqlClient; class Program { static void Main() { string conne ...

  2. idea使用插件activate-power-mode给编码加上特效和带来乐趣。

    一.安装. 1. 2. 二.使用. 1. 2.

  3. 35. Search Insert Position(二分查找)

    Given a sorted array and a target value, return the index if the target is found. If not, return the ...

  4. 27Tcp文件传输

    前面介绍了TCP和UDP的通信,只是文体通信,只能传送文字.本次介绍文件传输,也就是文件读写和TCP通信的结合. 解析:根据之前的TCP通信,建立彼此的连接.服务器选择文件,首先将文件的基本信息发送给 ...

  5. java压缩zip文件中文乱码问题

    用java来打包文件生成压缩文件,有两个地方会出现乱码 1.内容的中文乱码问题,这个问题网上很多人给出了解决方法,两种:修改sun的源码:使用开源的类库org.apache.tools.zip.Zip ...

  6. Centos75 firewalld防火墙

    Centos75 防火墙iptables被firewalld取代 #启动firewalld systemctl start firewalld #查看firewalld systemctl statu ...

  7. Python面试题目之列表去重并维持原来顺序

    题目: 列表去掉重复元素,并保持原来的排序 方法一: # 待处理的列表 L1 = [111,44,55,33,22,11] # 利用集合set的属性,去重 s1 = set(L1) # 把集合转化为列 ...

  8. Golang 中的指针 - Pointer

    http://www.cnblogs.com/jasonxuli/p/6802289.html   Go 的原生数据类型可以分为基本类型和高级类型,基本类型主要包含 string, bool, int ...

  9. 【定义及安装】Ambari——大数据平台的搭建利器

    Ambari 是什么 Ambari 跟 Hadoop 等开源软件一样,也是 Apache Software Foundation 中的一个项目,并且是顶级项目.目前最新的发布版本是 2.0.1,未来不 ...

  10. BloomFilter–大规模数据处理利器

    转自: http://www.dbafree.net/?p=36 BloomFilter–大规模数据处理利器 Bloom Filter是由Bloom在1970年提出的一种多哈希函数映射的快速查找算法. ...