《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窗 代码: %% ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
随机推荐
- python一段代码 感受一下
class T(): def aa(self): write = 1 print '123' class B(): def hehe(self) ...
- 从Linux服务器下载文件到本地命令
从Linux服务器下载文件夹到本地1.使用scp命令 scp /home/work/source.txt work@192.168.0.10:/home/work/ #把本地的source.txt文件 ...
- linux及安全《Linux内核设计与实现》第四章——20135227黄晓妍
第四章 进程调度 进程调度程序是一个内核子系统 分配有限的处理器时间和资源 最大限度利用时间的原则(只要有可执行的进程,那么总会有进程执行) 基本工作:从一组处于等待(阻塞)状态的可执行进程中选择一个 ...
- android的hook方面知识点
android hook分为另种: native层hook---理解ELF文件 java层---虚拟机特性和Java上的反射的作用 注入代码: 存放在哪? 用mmap函数分配临时内存来完成代码存放,对 ...
- Ubuntu下录制屏幕并转换成gif【转】
本文转载自:https://blog.csdn.net/u012964944/article/details/50464263 *录制屏幕 1)打开Ubuntu软件中心,安装RecordMyDeskt ...
- How does flyway sort version numbers?
https://stackoverflow.com/questions/19984397/how-does-flyway-sort-version-numbers In one word: numer ...
- [kata] Playing with digits
package kata_011; /** * Some numbers have funny properties. For example: * * 89 --> 8¹ + 9² = 89 ...
- java bitmap/bitvector的分析和应用
转自: http://shmilyaw-hotmail-com.iteye.com/blog/1741608 简介 bitmap在很多海量数据处理的情况下会用到.一些典型的情况包括数据过滤, ...
- Hadoop-1.0.4集群搭建笔记
这篇文章介绍的是简单的配置Hadoop集群的方法,适合实验和小型项目用,正式运行的集群需要用更正规的方法和更详细的参数配置,不适合使用这篇文章. 相关随笔: 用python + hadoop stre ...
- SpringBoot使用Redis数据库
(1)pom.xml文件引入jar包,如下: <dependency> <groupId>org.springframework.boot</groupId> &l ...