I would like to generate some figures to show the disadvantages of using Fourier transforms for time series analysis. I aim to show that 2 apparently very distinct signals have a spectra with very similar shape. To begin I create my series:
t = 0:.01:2;
y = sin(2.*pi.*5.*t)+sin(2.*pi.*10.*t);
r1 = find(t <= 1);
r2 = find(t > 1);
y2a = sin(2.*pi.*5.*t(r1));
y2b = sin(2.*pi.*10.*t(r2));
y2 = [y2a,y2b];
figure(1);
subplot(211);
plot(t,y,'k');
subplot(212);
plot(t,y2,'k');
Producing:
Now, I would like to show that their spectra have very similar shapes:
These are examples taken from some class notes that I would like to reproduce in matlab. However, I am having difficulties in reproducing the second plot. Could anyone suggest how the second plot can be produced in matlab with the information provided?