具有4个频率的多音余弦波。组件仅显示3个峰

时间:2015-01-01 12:53:43

标签: matlab signal-processing fft wavelet haar-wavelet

我有四个非平稳信号的频率成分,如下面的代码所示。当我试图绘制这些信号的频域时,我得到的图形只有三个频率峰值,如下图所示。?!

请告诉我为什么我只有三个峰值,而我有四个频率。组件。

% Time specifications:
Fs = 8000;                       % samples per second
dt = 1/Fs;                       % seconds per sample
StopTime = 2;                    % seconds
t = (0:dt:StopTime-dt);             % seconds

t1 = (0:dt:.25);
t2 = (.25:dt:.50);
t3 = (.5:dt:.75);
t4 = (.75:dt:1);

x1 = (10)*sin(2*pi*10*t1);
x2 = (10)*sin(2*pi*20*t2) + x1;
x3 = (10)*sin(2*pi*50*t3) + x2;
x4 = (10)*sin(2*pi*70*t4) + x3;

NFFT  = 2 ^ nextpow2(length(t));     % Next power of 2 from length of y
Y    = fft(x4, NFFT);
f    = Fs / 2 * linspace(0, 1, NFFT/2 + 1);
figure;
plot(f(1:200), 2 * abs( Y( 1:200) ) );

% Plot the signal versus time:
figure;
xlabel('time (in seconds)');
ylabel('Amplitude');
title('non-stationary Signal versus Time');

hold on
plot(t1,x1,'r');
plot(t2,x2,'g');
plot(t3,x3,'b');
 plot(t4,x4,'black');
  legend('x1 = (10)*sin(2*pi*15*t1) + (10)*sin(2*pi*8*t1)', 'x2 = (10)*sin(2*pi*25*t2)   
 +    
 x1', 'x3 = (10)*sin(2*pi*50*t3) + x2', 'x4 = (10)*sin(2*pi*75*t4) + x3', ...
'Location',  'SouthWest');

图片:enter image description here

1 个答案:

答案 0 :(得分:0)

您已经为x3绘制了fft,这只是前三个信号的总和。我认为你的意思是为x4绘制它,其中包括第四个信号。