博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
《DSP using MATLAB》Problem 2.7
阅读量:4963 次
发布时间:2019-06-12

本文共 3109 字,大约阅读时间需要 10 分钟。

 

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-filefprintf('\n***********************************************************\n');fprintf('        
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 onsubplot(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 onsubplot(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 onfigure('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 onsubplot(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 onsubplot(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 onsubplot(2,1,2); stem(m,imag(fliplr(xo))); title('Imag Part of xo(-m)');xlabel('m'); ylabel('Imag[xo(-m)]'); grid on

  运行结果:

 

转载于:https://www.cnblogs.com/ky027wh-sx/p/7976519.html

你可能感兴趣的文章
ASP.NET中 GridView(网格视图)的使用前台绑定
查看>>
深入了解Oracle ASM(二):ASM File number 1 文件目录
查看>>
Boosting(提升方法)之AdaBoost
查看>>
Binding object to winForm controller through VS2010 Designer(通过VS2010设计器将对象绑定到winForm控件上)...
查看>>
Spring Boot实战笔记(二)-- Spring常用配置(Scope、Spring EL和资源调用)
查看>>
SwaggerUI+SpringMVC——构建RestFul API的可视化界面
查看>>
springmvc怎么在启动时自己执行一个线程
查看>>
C# 通知机制 IObserver<T> 和 IObservable<T>
查看>>
Code of Conduct by jsFoundation
查看>>
C#小练习ⅲ
查看>>
电源防反接保护电路
查看>>
arraylist
查看>>
zoj 1649 Rescue (BFS)(转载)
查看>>
2124: 等差子序列 - BZOJ
查看>>
字符串匹配算法综述
查看>>
Linux centosVMware shell 管道符和作业控制、shell变量、环境变量配置文件
查看>>
【设计模式】工厂模式
查看>>
两个表格中数据不用是一一对应关系--来筛选不同数据,或者相同数据
查看>>
客户数据库出现大量cache buffer chains latch
查看>>
機械の総合病院 [MISSION LEVEL: C]
查看>>