急需MATLAB程序,用FFT求信号x(t)=sin(40πt)的频谱观察采样间隔和长度取不同值时(如T=0.02,0.04;N=100,105),频谱的变化,判断是否反映信号的真实频谱.
问题描述:
急需MATLAB程序,用FFT求信号x(t)=sin(40πt)的频谱
观察采样间隔和长度取不同值时(如T=0.02,0.04;N=100,105),频谱的变化,判断是否反映信号的真实频谱.
答
clc; clear ;close all;T1 = 0.02;T2 = 0.04;fs1 = 1/T1;fs2 = 1/T2;t1 = 0:T1:20;t2 = 0:T2:20;x1 = sin(40*pi*t1);x2 = sin(40*pi*t2);y1 = abs(fft(x1));y2 = abs(fft(x2));n1 = (1:length(t1))*fs1/length(t1);n...