• 离散傅里叶变换(DTFT) MATLAB实例


    image

    w = [0:1:500]*pi/500;
    X= exp(1i*w) ./ (exp(1i*w) - 0.5*ones(1,501));        %ones : Create array of all ones
    magX= abs(X);
    angX = angle(X);
    realX = real(X);
    imagX = imag(X);
    subplot(2,2,1); plot(w/pi, magX);grid
    xlabel('frequency in pi unit' );
    title ('magnitude part');      
    ylabel('magnitude');       
    subplot(2,2,2);plot(w/pi,angX);grid                     %subplot 为图表定位 2X2图表中第2张
    xlabel('frequevcy in pi unit');                                 %X轴坐标
    title('angle part');
    ylabel('radians');
    subplot(2,2,3);plot(w/pi, realX );grid                      %grid为图标加网格线
    xlabel('frequency in pi unit' );
    title('real part');
    ylabel('real');
    subplot(2,2,4);plot(w/pi, imagX);grid
    xlabel('frequency in pi unit');
    title('imag part');
    ylabel('imag');

    image

    n = -1:3;
    x = 1:5;
    w= (0:1:500)*pi/500;                             
    X= x* exp(-j).^(n'*w);                                          %n'  :矩阵n的转制
    realX = real(X);
    imagX = imag(X);
    angX = angle(X);
    magX = abs(X);
    subplot(2,2,1);plot(w/pi,magX);grid
    xlabel('fequency in pi unit');
    title('magnitude part');
    subplot(2,2,2);plot(w/pi,realX);grid
    xlabel('frequency in pi unit');
    title('real part');
    subplot(2,2,3);plot(w/pi,imagX);grid
    xlabel('frequency in pi unit');
    title( 'imaginary part');
    subplot(2,2,4);plot(w/pi, angX);grid
    xlabel('frequency in pi unit');
    title('angle part');

    image

    %求出某一f上   所有时间上所有值
    n= 0:10;%确定n的范围
    w= (-200:1:200)*pi/100;%确定要观察的频率范围
    x = (0.9*exp(1i*pi/3)).^n;%确定时间轴上的函数值
    X = x*(exp(-1i)).^(n'*w);%转换到频率轴上
    magX = abs(X);
    angX = angle(X);
    subplot(2,1,1);
    plot(w/pi,magX);grid
    subplot(2,1,2);
    plot(w/pi, angX);grid

    image

    %axis 轴        axis()     axis([xmin xmax ymin ymax])
    %当输入函数为实数时     观察幅值(偶)与相位(奇)的对称性
    n = -10:10 ;
    w = (-200:1:200)*pi/100;
    x = (-0.9).^n;
    X = x * (exp(-1i).^(n'*w));
    magX = abs(X);
    angX = angle(X);
    subplot(2,1,1);
    plot(w/pi,magX);grid
    axis([-2,2,0,30]);
    title('magnitude part');
    subplot(2,1,2);
    plot(w/pi, angX);grid
    title('angle part')

  • 相关阅读:
    牛客 Wannafly 挑战赛26D 禁书目录 排列组合 概率期望
    UOJ#269. 【清华集训2016】如何优雅地求和
    斯特林数 学习笔记
    AtCoder Grand Contest 006 (AGC006) C
    Codeforces 1045D Interstellar battle 概率期望
    Codeforces 1045A Last chance 网络流,线段树,线段树优化建图
    Codeforces 1053C Putting Boxes Together 树状数组
    Codeforces 109D String Transformation 字符串 哈希 KMP
    AtCoder Grand Contest 1~10 做题小记
    AtCoder Grand Contest 002 (AGC002) F
  • 原文地址:https://www.cnblogs.com/sleepy/p/2088431.html
Copyright © 2020-2023  润新知