用到的性质

上代码:

  1. n = -5:10; x = rand(1,length(n)) + j * rand(1,length(n));
  2. k = -100:100; w = (pi/100)*k; % freqency between -pi and +pi , [0,pi] axis divided into 101 points.
  3. X = x * (exp(-j*pi/100)) .^ (n'*k); % DTFT of x
  4.  
  5. % conjugation property
  6. y = conj(x); % signal conjugation
  7. Y = y * (exp(-j*pi/100)) .^ (n'*k); % DTFT of y
  8.  
  9. magX = abs(X); angX = angle(X); realX = real(X); imagX = imag(X);
  10. magY = abs(Y); angY = angle(Y); realY = real(Y); imagY = imag(Y);
  11.  
  12. %verification
  13. Y_check = conj(fliplr(X)); % conj(X(-w)) DTFT flip first, then conjugation
  14. error = max(abs(Y-Y_check)); % Difference
  15.  
  16. figure('NumberTitle', 'off', 'Name', 'x & y sequence')
  17. set(gcf,'Color','white');
  18. subplot(2,2,1); stem(n,real(x)); title('x sequence Real Part'); xlabel('n'); ylabel('Real x(n)'); grid on;
  19. subplot(2,2,2); stem(n,imag(x)); title('x sequence Imaginary Part'); xlabel('n'); ylabel('Imaginary x(n))'); grid on;
  20. subplot(2,2,3); stem(n,real(y)); title('y sequence Real Part'); xlabel('n'); ylabel('Real y(n)'); grid on;
  21. subplot(2,2,4); stem(n,imag(y)); title('y sequence Imaginary Part'); xlabel('n'); ylabel('Imaginary y(n))'); grid on;
  22.  
  23. %% ----------------------------------------------------------------
  24. %% START Graphical verification
  25. %% ----------------------------------------------------------------
  26. figure('NumberTitle', 'off', 'Name', 'X Y compare theirs Magnitude and Angle');
  27. set(gcf,'Color','white');
  28. subplot(2,2,1); plot(w/pi,magX); grid on; axis([-1,1,0,12]);
  29. xlabel('frequency in \pi units'); ylabel('|X|'); title('Magnitude of X ');
  30. subplot(2,2,2); plot(w/pi,angX/pi); grid on; axis([-1,1,-1,1]);
  31. xlabel('frequency in \pi units'); ylabel('Radians/\pi'); title('Angle of X ');
  32.  
  33. subplot(2,2,3); plot(w/pi,magY); grid on; axis([-1,1,0,12]);
  34. xlabel('frequency in \pi units'); ylabel('|Y|'); title('Magnitude of Y ');
  35. subplot(2,2,4); plot(w/pi,angY/pi); grid on; axis([-1,1,-1,1]);
  36. xlabel('frequency in \pi units'); ylabel('Radians/\pi'); title('Angle of Y ');
  37.  
  38. %% ----------------------------------------------------------------
  39. %% END Graphical verification
  40. %% ----------------------------------------------------------------

 运行结果:

DSP using MATLAB 示例 Example3.10的更多相关文章

  1. 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 ...

  2. DSP using MATLAB 示例 Example3.19

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Discrete-time Signa ...

  3. DSP using MATLAB示例Example3.18

    代码: % Analog Signal Dt = 0.00005; t = -0.005:Dt:0.005; xa = exp(-1000*abs(t)); % Continuous-time Fou ...

  4. 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 ...

  5. 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, ...

  6. 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 ...

  7. 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 , ...

  8. DSP using MATLAB 示例 Example3.11

    用到的性质 上代码: n = -5:10; x = rand(1,length(n)); k = -100:100; w = (pi/100)*k; % freqency between -pi an ...

  9. 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 = ...

随机推荐

  1. c++从文件中读取特定字符串问题的总结

    1.每次从文件中读出一行作为一个字符串 可以用ifstream()函数来打开一个文件,然后用while加getline()函数即可每次读一行文件,直到文件结束 #include<unistd.h ...

  2. Android Shape自定义纯色圆角按钮

    版权声明:分享技术,传播快乐.如果本博客对你有帮助,请在我的博客首页为我打赏吧! 在Android开发中,为响应美化应用中控件的效果,使用Shape定义图形效果,可以解决图片过多的问题. 首先看一下效 ...

  3. LeetCode 191 Number of 1 Bits

    Problem: Write a function that takes an unsigned integer and returns the number of '1' bits it has ( ...

  4. [Android Pro] AIDL进程间传递自定义类型参数

    1.创建.aidl 文件 AIDL 语法简单,用来声明接口,其中的方法接收参数和返回值,但是参数和返回值的类型是有约束的,且有些类型是需要 import,另外一些则无需这样做. AIDL 支持的数据类 ...

  5. JAVA addShutdownHook测试

    public static void main(String[] args) { System.out.println("1111111111"); try { Thread.sl ...

  6. 在web.xml中classpath和classpath*的区别

    classpath 和 classpath* 区别: classpath:只会到你指定的class路径中查找找文件; classpath*:不仅包含class路径,还包括jar文件中(class路径) ...

  7. hdu1018(数位)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1018 题意:求n!的数位(即n!有多少位): 思路:对于一个数x,它的数位ans=log10(x): ...

  8. hdu 5108 Alexandra and Prime Numbers

    数论题,本质是求出n的最大质因子 #include<time.h> #include <cstdio> #include <iostream> #include&l ...

  9. jquery学习笔记----ajax使用

    一.load() 加载页面数据 load(url,[data],[callback]) url:加载的页面地址,[data]传送的数据,[callback]加载完成时回调函数. 设计一个load.ht ...

  10. n的阶乘高精度算法【阶乘】

    C语言实验——求阶乘(循环结构) Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 题目链接:http://acm.sdut.edu ...