我正在对正弦波进行一些分析,我注意到一些奇怪的东西。当我在正弦帧中的任意点随机引入单个样本脉冲时,FFT 未能找到它。直观地说,脉冲的 FFT 应该是正弦波,但我什么也没得到。事实上,我会说信息丢失了。为什么会这样?
要绝对清楚生成此代码的代码:
Fs=10e3; %Specify Sampling Frequency
Ts=1/Fs; %Sampling period.
Ns= 1024; %Number of time samples to be plotted.
temp = Ts*(Ns-1);
t=[0:Ts:Ts*(Ns-1)]; %Make time array that contains Ns elements
%t = [0, Ts, 2Ts, 3Ts,..., (Ns-1)Ts]
f1= 60;
f2=1000;
f3=2000;
f4=3200;
x1=sin(2*pi*f1*t (1 : size(t, 2)/2)); %create sampled sinusoids at different frequencies
x1(1, 400) = 5;
x2=cos(2*pi*f2*t (size(t, 2)/2 + 1: size(t, 2))) ;
x = [x1 x2];
xfftmag=(abs(fft(x)));
xfftmagh=xfftmag(1:length(xfftmag)/2);
%Plot only the first half of FFT, since second half is mirror imag
%the first half represents the useful range of frequencies from
%0 to Fs/2, the Nyquist sampling limit.
f=[1:1:length(xfftmagh)]*Fs/Ns; %Make freq array that varies from
%0 Hz to Fs/2 Hz.
[ca, cd] = swt(x, 1, 'haar');