《DSP using MATLAB》Problem 2.7


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的更多相关文章
- 《DSP using MATLAB》Problem 7.27
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.26
注意:高通的线性相位FIR滤波器,不能是第2类,所以其长度必须为奇数.这里取M=31,过渡带里采样值抄书上的. 代码: %% +++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.25
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.24
又到清明时节,…… 注意:带阻滤波器不能用第2类线性相位滤波器实现,我们采用第1类,长度为基数,选M=61 代码: %% +++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.23
%% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output Info a ...
- 《DSP using MATLAB》Problem 7.16
使用一种固定窗函数法设计带通滤波器. 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.15
用Kaiser窗方法设计一个台阶状滤波器. 代码: %% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
- 《DSP using MATLAB》Problem 7.14
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.13
代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ %% Output In ...
- 《DSP using MATLAB》Problem 7.12
阻带衰减50dB,我们选Hamming窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- C# static的用法详解
C# static的用法详解 有的东西你天天在用,但未必就代表你真正了解它,正如我之前所了解的 static . 一.静态类 静态类与非静态类的重要区别在于静态类不能实例化,也就是说,不能使用 n ...
- javascript原生事件总结
javascript原生的事件,总结了一下,包括事件流.处理函数.事件对象这几样东西.而在兼容性方面,主要是老牌ie8以及以下和现代浏览器的差异,也就是ie和DOM事件标准的差异. 事件流这个事件流i ...
- nginx自动生成缩略图
网站上常常一张图片,多个地方需要使用不同的尺寸,一般的方案是上传的时候,根据不同的尺寸用程序生成多张图片. 这么做有两个缺点: 1.如果需要新的尺寸图片的话,只能遍历下数据库,重新生成一次图片. 2. ...
- tcpdump 的正确食用方法
目录 tcpdump 使用笔记 重要报文头 字段表 ip header tcp header 基础使用 高级版本 指定ttl(通过ttl能够确定系统的类型) tcpdump 使用笔记 重要报文头 字段 ...
- iptable的使用
目录 iptables iptables iptables详解 2012-07-18 20:10:08 分类: LINUX 一:前言 防火墙,其实说白了讲,就是用于实现Linux下访问控制的功能的,它 ...
- CentOS6安装Pyhon3
一,从官方下载Python3.6 [root@linux-node1 src]# pwd /usr/local/src [root@linux-node1 src]# wget https://www ...
- luogu p1101 单词方阵
https://www.luogu.org/problem/show?pid=1101 很恶心的代码 就是八个方向都搜索 #include<bits/stdc++.h> using na ...
- 发起图片请求的几种可能性(webkit内核)
网页测试源代码: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> &l ...
- hdu 4739 Zhuge Liang's Mines DFS
http://acm.hdu.edu.cn/showproblem.php?pid=4739 题意: 给定100*100的矩阵中n(n<= 20)个点,每次只能一走能够形成正方形的四个点,正方形 ...
- Codeforces Round #381 (Div. 2) D. Alyona and a tree dfs序+树状数组
D. Alyona and a tree time limit per test 2 seconds memory limit per test 256 megabytes input standar ...