• 信号基础知识--FFT DFT


    clc;close all;clear all;

    f0=10; fs=100;     %采样率 t=1/fs:1/fs:2;         %共两秒钟,共200个采样点。采样间隔T=1/100

    y1=sin(2*pi*f0*t);

    y2=square(2*pi*f0*t);

    noise=rand(1,200);

    z1=y1+noise;

    z2=y2+noise;

    fft_y1=fft(y1); dft200_y1=fft(y1,200); dft100_y1=fft(y1,100);

    figure;

    subplot(311);plot(abs(fft_y1));xlabel('frez');ylabel('|e^j^omega/|');title('fft_y1');

    subplot(312);plot(abs(dft200_y1));xlabel('omega/pi');ylabel('dft200_y1');title('200点 DFT y1');

    subplot(313);plot(abs(dft100_y1));xlabel('omega/pi');ylabel('dft100_y1');title('100点 DFT y1');

    %----------------------------------------------------------------------------------------

    fft_noise=fft(noise); dft200_noise=fft(noise,200); dft100_noise=fft(noise,100);

    figure;

    subplot(311);plot(abs(fft_noise));xlabel('frez');ylabel('|e^j^omega/|');title('fft_noise');

    subplot(312);plot(abs(dft200_noise));xlabel('omega/pi');ylabel('dft200_noise');title('200点 DFT noise');

    subplot(313);plot(abs(dft100_noise));xlabel('omega/pi');ylabel('dft100_noise');title('100点 DFT noise');

    ==========================================================================================

    fft_z1=fft(z1); dft200_z1=fft(z1,200);  %dft变换,2*pi上平均采200个点 dft100_z1=fft(z1,100);

    figure;

    subplot(311);plot(abs(fft_z1)); xlabel('frez');ylabel('fft_z1');title('z1_fft');

    subplot(312);plot(abs(dft200_z1)); xlabel('omega/pi');ylabel('dft200_z1');title('200点 DFT z1');

    subplot(313);plot(abs(dft100_z1)); xlabel('omega/pi');ylabel('dft100_z1');title('100点 DFT z1');

     

  • 相关阅读:
    Codeforces 271 Div 2 B. Worms
    Codeforces 271 Div 2 A Keyboard
    CSU 1333 Funny Car Racing (最短路)
    CSU 1337 搞笑版费马大定理(2013湖南省程序设计竞赛J题)
    CSU 1328 近似回文词(2013湖南省程序设计竞赛A题)
    HDU 5033 Building
    HDU 1058 Humble Numbers(离线打表)
    HDU 5047 Sawtooth(大数模拟)上海赛区网赛1006
    HDU 5053 the Sum of Cube
    MySQL练习-employees数据库(二)
  • 原文地址:https://www.cnblogs.com/kiki--xiunai/p/10710098.html
Copyright © 2020-2023  润新知