DSP using MATLAB 示例Example3.9
用到的性质
上代码:
n = 0:100; x = cos(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 multiplied
y = exp(j*pi*n/4) .* x; % signal multiplied by exp(j*pi*n*4)
Y = y * (exp(-j*pi/100)) .^ (n'*k); % DTFT of y magX = abs(X); angX = angle(X); realX = real(X); imagX = imag(X);
magY = abs(Y); angY = angle(Y); realY = real(Y); imagY = imag(Y); %verification
%Y_check = (exp(-j*2) .^ w) .* X; % multiplication by exp(-j2w)
%error = max(abs(Y-Y_check)); % Difference figure('NumberTitle', 'off', 'Name', 'x & y sequence')
set(gcf,'Color','white');
subplot(2,1,1); stem(n,x); title('x=cos(\pin/2) sequence'); xlabel('n'); ylabel('x(n)'); grid on;
subplot(2,1,2); stem(n,y); title('y=exp(j\pin/4)cos(\pin/2) sequence'); xlabel('n'); ylabel('y(n)'); 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([-2,2,0,15]);
title('Magnitude Part');
xlabel('frequency in \pi units'); ylabel('Magnitude |X|');
subplot(2,2,3); plot(w/pi, angX/pi); grid on; % axis([-2,2,-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 Y's mag ang real imag
%% --------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'Y its Magnitude and Angle, Real and Imaginary Part');
set(gcf,'Color','white');
subplot(2,2,1); plot(w/pi,magY); grid on; % axis([-2,2,0,15]);
title('Magnitude Part');
xlabel('frequency in \pi units'); ylabel('Magnitude |Y|');
subplot(2,2,3); plot(w/pi, angY/pi); grid on; % axis([-2,2,-1,1]);
title('Angle Part');
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); subplot('2,2,2'); plot(w/pi, realY); grid on;
title('Real Part');
xlabel('frequency in \pi units'); ylabel('Real');
subplot('2,2,4'); plot(w/pi, imagY); grid on;
title('Imaginary Part');
xlabel('frequency in \pi units'); ylabel('Imaginary'); %% --------------------------------------------------------------
%% END Y's mag ang real imag
%% -------------------------------------------------------------- %% ----------------------------------------------------------------
%% START Graphical verification
%% ----------------------------------------------------------------
figure('NumberTitle', 'off', 'Name', 'X Y compare theirs Magnitude and Angle');
set(gcf,'Color','white');
subplot(2,2,1); plot(w/pi,magX); grid on; axis([-1,1,0,60]);
xlabel('frequency in \pi units'); ylabel('|X|'); title('Magnitude of X ');
subplot(2,2,2); plot(w/pi,angX/pi); grid on; axis([-1,1,-1,1]);
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); title('Angle of X '); subplot(2,2,3); plot(w/pi,magY); grid on; axis([-1,1,0,60]);
xlabel('frequency in \pi units'); ylabel('|Y|'); title('Magnitude of Y ');
subplot(2,2,4); plot(w/pi,angY/pi); grid on; axis([-1,1,-1,1]);
xlabel('frequency in \pi units'); ylabel('Radians/\pi'); title('Angle of Y '); %% ----------------------------------------------------------------
%% END Graphical verification
%% ----------------------------------------------------------------
运行结果:
DSP using MATLAB 示例Example3.9的更多相关文章
- 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.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
- DSP using MATLAB 示例 Example3.15
上代码: subplot(1,1,1); b = 1; a = [1, -0.8]; n = [0:100]; x = cos(0.05*pi*n); y = filter(b,a,x); figur ...
- DSP using MATLAB 示例 Example3.13
上代码: w = [0:1:500]*pi/500; % freqency between 0 and +pi, [0,pi] axis divided into 501 points. H = ex ...
- 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 , ...
随机推荐
- (转)JAVA AJAX教程第二章-JAVASCRIPT基础知识
开篇:JAVASCRIPT是AJAX技术中不可或缺的一部分,所以想学好AJAX以及现在流行的AJAX框架,学好JAVASCRIPT是最重要的.这章我给大家整理了一些JAVASCRIPT的基础知识.常用 ...
- sql server 取日期
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM Select CONVERT(varchar(100), GETDATE( ...
- JAVA回调接口的理解
A类持有B接口的对象引用,B接口有一个callBack()方法,C类是B类的实现类,实现了callBack()方法,把C类传入A类,当A类执行完操作后调用callBack()方法,这时候A调用的就是C ...
- 【python】词法语法解析模块ply
官方手册:http://www.dabeaz.com/ply/ply.html 以下例子都来自官方手册: 以四则运算为例: x = 3 + 42 * (s - t) 词法分析: 需要将其分解为: 'x ...
- 如何:使用PicturBox实现类似淘宝网站图片的局部放大功能
转载至http://xuzhihong1987.blog.163.com/blog/static/267315872011822113131823/ 概要: 本文将讲述如何使用PictureBox控件 ...
- delphi 控件大全(确实很全)
delphi 控件查询:http://www.torry.net/ http://www.jrsoftware.org Tb97 最有名的工具条(ToolBar)控件库,仿Office97,如TDoC ...
- [Android Pro] CPU占用计算方法
1: AVTest CPU计算方法读取每个进程的 stat 文件 (/proc/<PID>/stat)计算采样间隔10min下utime的差值minusUtime,stime的差值min ...
- Git - 使用指南
GIT (分布式版本控制系统) 编辑 Git是一款免费.开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目.[1] Git的读音为/gɪt/. Git是一个开源的分布式版本控制系统,可以 ...
- php 分页查询
get方法 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...
- iis 7.5应用程序池自动停止
今天在我的windows7旗舰版上配置iis7 (Internet Information Server)失败,一直未能启动服务,访问本地网络提示"Service Unavailable H ...