DSP using MATLAB 示例 Example3.12
用到的性质
代码:
n = -5:10; x = sin(pi*n/2);
k = -100:100; w = (pi/100)*k; % freqency between -pi and +pi , [0,pi] axis divided into 101 points.
X = x * (exp(-j*pi/100)) .^ (n'*k); % DTFT of x % signal decomposition
[xe,xo,m] = evenodd(x,n); % even and odd parts
XE = xe * (exp(-j*pi/100)) .^ (m'*k); % DTFT of xe
XO = xo * (exp(-j*pi/100)) .^ (m'*k); % DTFT of xo magXE = abs(XE); angXE = angle(XE); realXE = real(XE); imagXE = imag(XE);
magXO = abs(XO); angXO = angle(XO); realXO = real(XO); imagXO = imag(XO);
magX = abs(X); angX = angle(X); realX = real(X); imagX = imag(X); %verification
XR = real(X); % real part of X
error1 = max(abs(XE-XR)); % Difference
XI = imag(X); % imag part of X
error2 = max(abs(XO-j*XI)); % Difference figure('NumberTitle', 'off', 'Name', 'x sequence')
set(gcf,'Color','white');
stem(n,x); title('x sequence'); xlabel('n'); ylabel('x(n)'); grid on; figure('NumberTitle', 'off', 'Name', 'xe & xo sequence')
set(gcf,'Color','white');
subplot(2,1,1); stem(m,xe); title('xe sequence '); xlabel('m'); ylabel('xe(m)'); grid on;
subplot(2,1,2); stem(m,xo); title('xo sequence '); xlabel('m'); ylabel('xo(m)'); grid on; %% --------------------------------------------------------------------
%% START X's mag ang real imag
%% --------------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'X its Magnitude and Angle, Real and Imaginary Part');
set(gcf,'Color','white');
subplot(2,2,1); plot(w/pi,magX); grid on; axis([-1,1,0,9]);
title('Magnitude Part');
xlabel('frequency in \pi units'); ylabel('Magnitude |X|');
subplot(2,2,3); plot(w/pi, angX/pi); grid on; axis([-1,1,-1,1]);
title('Angle Part');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); subplot('2,2,2'); plot(w/pi, realX); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot('2,2,4'); plot(w/pi, imagX); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary');
%% -------------------------------------------------------------------
%% END X's mag ang real imag
%% ------------------------------------------------------------------- %% --------------------------------------------------------------
%% START XE's mag ang real imag
%% --------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'XE its Magnitude and Angle, Real and Imaginary Part');
set(gcf,'Color','white');
subplot(2,2,1); plot(w/pi,magXE); grid on; axis([-1,1,0,2]);
title('Magnitude Part');
xlabel('frequency in \pi units'); ylabel('Magnitude |XE|');
subplot(2,2,3); plot(w/pi, angXE/pi); grid on; axis([-1,1,-1,1]);
title('Angle Part');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); subplot('2,2,2'); plot(w/pi, realXE); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot('2,2,4'); plot(w/pi, imagXE); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary'); %% --------------------------------------------------------------
%% END XE's mag ang real imag
%% -------------------------------------------------------------- %% --------------------------------------------------------------
%% START XO's mag ang real imag
%% --------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'XO its Magnitude and Angle, Real and Imaginary Part');
set(gcf,'Color','white');
subplot(2,2,1); plot(w/pi,magXO); grid on; axis([-1,1,0,8]);
title('Magnitude Part');
xlabel('frequency in \pi units'); ylabel('Magnitude |XO|');
subplot(2,2,3); plot(w/pi, angXO/pi); grid on; axis([-1,1,-1,1]);
title('Angle Part');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); subplot('2,2,2'); plot(w/pi, realXO); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot('2,2,4'); plot(w/pi, imagXO); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary'); %% --------------------------------------------------------------
%% END XO's mag ang real imag
%% -------------------------------------------------------------- %% ----------------------------------------------------------------
%% START Graphical verification
%% ----------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'Graphical verification');
set(gcf,'Color','white');
subplot(2,2,1); plot(w/pi,XR); grid on; axis([-1,1,-2,2]);
xlabel('frequency in \pi units'); ylabel('Re(X)'); title('Real Part of X ');
subplot(2,2,2); plot(w/pi,XI); grid on; axis([-1,1,-10,10]);
xlabel('frequency in \pi units'); ylabel('Im(X)'); title('Imaginary Part of X '); subplot(2,2,3); plot(w/pi,realXE); grid on; axis([-1,1,-2,2]);
xlabel('frequency in \pi units'); ylabel('XE'); title('Transform of even part ');
subplot(2,2,4); plot(w/pi,imagXO); grid on; axis([-1,1,-10,10]);
xlabel('frequency in \pi units'); ylabel('XO'); title('Transform of odd part'); %% ----------------------------------------------------------------
%% END Graphical verification
%% ----------------------------------------------------------------
运行结果:
DSP using MATLAB 示例 Example3.12的更多相关文章
- DSP using MATLAB 示例Example3.21
代码: % Discrete-time Signal x1(n) % Ts = 0.0002; n = -25:1:25; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*a ...
- DSP using MATLAB 示例 Example3.19
代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signa ...
- DSP using MATLAB示例Example3.18
代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Continuous-time Fou ...
- DSP using MATLAB 示例Example3.23
代码: % Discrete-time Signal x1(n) : Ts = 0.0002 Ts = 0.0002; n = -25:1:25; nTs = n*Ts; x1 = exp(-1000 ...
- DSP using MATLAB示例Example3.16
代码: b = [0.0181, 0.0543, 0.0543, 0.0181]; % filter coefficient array b a = [1.0000, -1.7600, 1.1829, ...
- DSP using MATLAB 示例 Example3.11
用到的性质 上代码: n = -5:10; x = rand(1,length(n)); k = -100:100; w = (pi/100)*k; % freqency between -pi an ...
- DSP using MATLAB 示例 Example3.10
用到的性质 上代码: n = -5:10; x = rand(1,length(n)) + j * rand(1,length(n)); k = -100:100; w = (pi/100)*k; % ...
- DSP using MATLAB 示例Example3.22
代码: % Discrete-time Signal x2(n) Ts = 0.001; n = -5:1:5; nTs = n*Ts; Fs = 1/Ts; x = exp(-1000*abs(nT ...
- DSP using MATLAB 示例Example3.17
随机推荐
- loadrunner备忘
1.超时设置 2. 可能是操作系统的环境不适合或者浏览器的版本有出入,具体的loadrunner版本支持的IE版本版本如下所示,请仔细核对是否正确.LR版本和IE版本兼容性问题,这个问题是我们安装环境 ...
- Linux定时任务设定
使用crontab 命令进行设定. 详情可参见:http://blog.csdn.net/xiyuan1999/article/details/8160977. 共有6项构成,前5项为时间:分 时 天 ...
- 添加本地jar到Maven库
转自:http://dk05408.iteye.com/blog/2170986 上传: mvn install:install-file -Dfile=D:/workspace/p2p_server ...
- c++ 头文件包含问题-include&class
http://blog.csdn.net/jiajia4336/article/details/8996254 前向声明概念(forward declaration) 在程序中引入了类类型的B.在声明 ...
- 常用shell命令操作
1.找出系统中所有的*.c 和*.h 文件 (-o 或者) $find / -name "*.cpp" -o -name "*.h" 2.设定 eth0 的 I ...
- Linux下Vi/Vim使用笔记
启动和关闭vim vi 打开 Vi/Vim 打开 Vi/Vim 并加载文件 <file> vi <file> vim编辑器的三种模式:一般模式.编辑模式和命令行模式在一般模式中 ...
- Shell编程基础教程1--Shell简介
1.Shell简介 1.1.查看你系统shell信息 cat /etc/shell 命令可以获取Linux系统里面有多少种shell程序 echo $SHELL 命令可以查看当前你所使用的shell是 ...
- OCJP(1Z0-851) 模拟题分析(五)over
Exam : 1Z0-851 Java Standard Edition 6 Programmer Certified Professional Exam 以下分析全都是我自己分析或者参考网上的,定有 ...
- java中常用的工具类(一)
我们java程序员在开发项目的是常常会用到一些工具类.今天我汇总了一下java中常用的工具方法.大家可以在项目中使用.可以收藏!加入IT江湖官方群:383126909 我们一起成长 一.String工 ...
- phpcms v9实现wap单页教程
下面以添加“关于我们”这一单页为例作phpcms V9 wap手机门户添加单页的教程说明: 步骤一:复制phpcms\templates\default\wap下的maps.html,粘贴重命名为ab ...