DSP using MATLAB 示例Example3.8
代码:
x = rand(1,11); n = 0:10;
k = 0:500; w = (pi/500)*k; % [0,pi] axis divided into 501 points.
X = x * (exp(-j*pi/500)) .^ (n'*k); % DTFT of x % signal shifted by two samples
y = x; m = n + 2;
Y = y * (exp(-j*pi/500)) .^ (m'*k); % DTFT of y = x(n-2) 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 sequence'); xlabel('n'); ylabel('x(n)'); grid on;
subplot(2,1,2); stem(m,y); title('y 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
%% --------------------------------------------------------------
运行结果:
DSP using MATLAB 示例Example3.8的更多相关文章
- 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 , ...
随机推荐
- 【python】pymongo查找某一时间段的数据
python中实现: 下面代码就是查找2016-09-26 00:00:00 ~ 2016-09-27 00:00:00 时间段的数据 from datetime import datetimefor ...
- 【XLL 文档翻译】【第2部分】C API 回调函数 Excel4, Excel12
Excel4 和 Excel12 函数使得 DLL 可以调用 Excel 工作表函数.宏表函数.命令.XLL特定函数或命令.最近的一些 Excel 版本都支持 Excel12 函数.这两个函数支持下面 ...
- cell分割线宽度不满屏处理
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [cell setSeparatorInset:UIEdgeInsetsZ ...
- [Android] 关于getinstalledpackages参数的分析
reference to : http://blog.csdn.net/luojiusan520/article/details/47696891 getinstalledpackages()的方法 ...
- [Android Pro] Gradle tip #3-Task顺序
reference to : http://blog.csdn.net/lzyzsd/article/details/46935405 原文链接 我注意到我在使用Gradle的时候遇到的大多数问题都是 ...
- [Android Pro] 通过包名启动应用
Intent intent = packageManager.getLaunchIntentForPackage(WEIXIN_PKGNAME); intent.setFlags(Intent.FLA ...
- W3C对DOM2.0定义的标准事件
DOM2.0模型将事件处理流程分为三个阶段: 一.事件捕获阶段, 二.事件目标阶段, 三.事件起泡阶段. 具体如图(图片来源于网络,侵删) 事件捕获:当某个元素触发某个事件(如onclick),顶层对 ...
- cookie的设置、获取以及删除
首先介绍一下cookie的基本信息: cookie是以域为单位的,它必须放在服务器的的环境下,但是cookie的容量小,只有4kb,并且也不安全,还有入股cookie的名字相同,会修改或者覆盖原来的值 ...
- SQLServer视图
视图简介:通过定义 SELECT 语句以检索将在视图中显示的数据来创建视图.SELECT 语句引用的数据表称为视图的基表.在SQL Server 2005系统中,可以把视图分为3种类型,即标准视图,索 ...
- *** Assertion failure in -[UIApplication _runWithMainScene:transitionContext iOS9.1闪退问题解决
错误原因在于 AppDelegate 中 didFinishLaunchingWithOptions 结束前 未定义 rootViewController,Xcode7规定必须要有rootViewCo ...