用到的性质

上代码:

n = -5:10; x = rand(1,length(n));
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 % folding property
y = fliplr(x); m = -fliplr(n); % signal folding
Y = y * (exp(-j*pi/100)) .^ (m'*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 = fliplr(X); % X(-w)
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,2,2); stem(n,imag(x)); title('x sequence Imaginary Part'); xlabel('n'); ylabel('Imaginary x(n))'); grid on;
subplot(2,1,2); stem(m,y); title('y sequence '); xlabel('n'); ylabel('y(n)'); grid on;
%subplot(2,2,4); stem(n,imag(y)); title('y sequence Imaginary Part'); xlabel('n'); ylabel('Imaginary 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,12]);
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,12]);
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
%% ----------------------------------------------------------------

运行结果:

最新文章

  1. 使用plsql创建表空间和用户
  2. session和cookie
  3. 利用 Android Gradle 瘦身 apk
  4. Linux给指定用户或全部用户(已登录)发送消息
  5. [Leetcode][JAVA] Longest Consecutive Sequence
  6. PL/SQL 下邮件发送程序
  7. CCNA第二讲笔记
  8. centos7和windows7双系统安装
  9. JSTL与EL常用标签(转)
  10. z-index 解析
  11. .13-Vue源码之patch(3)(终于完事)
  12. 3.MySQL(三)
  13. Day6 Numerical simulation of optical wave propagation之通过随机介质(如大气湍流)的传播(二)
  14. Project D | Digital life
  15. java虚拟机——垃圾回收机制
  16. 我是这样搞懂一个神奇的BUG
  17. linux ssh 报错failed - POSSIBLE BREAK-IN ATTEMPT
  18. SqlServer 查看死锁的进程
  19. maven docker 插件集成的几个小坑
  20. ubuntu修改时区

热门文章

  1. 微信video标签全屏无法退出bug 本文系转载
  2. 【leetcode】Convert Sorted Array to Binary Search Tree (easy)
  3. 【leetcode】Valid Sudoku (easy)
  4. stdafx.h的作用
  5. ppt动画制作bullets
  6. React Native官方DEMO
  7. Mac OS
  8. 与你相遇好幸运,The Moe Node.js Code Style Guide
  9. 七牛:关于图片 EXIF 信息中旋转参数 Orientation 的理解
  10. 【PHP的异常处理【完整】】