I'm trying to plot the frequency spectrum two signals y1 and y2[n] which both last for 3s each. y1[n] is the sum of 3 sinusoids present all the time with frequencies (10, 25 and 50 Hz). y2[n] is the concatenation of the three tones contained in y1[n], each tone last 1 second ie 10Hz from t=0s to t=1s, 25Hz from t=1s to t=2s and 50Hz for the last second. My fft fuction works perfectly for y1 but displays odd results for y2. I expect to see the three tones at 10, 25 and 50 Hz on the frequency spectrum with an amplitude of 1 but the frequncy spectrum of y2 shows the three tones at the correct frequency but the aplitude is wrong. How can i plot y2 correctly? I have included my fft code and the spectrums I plotted.
P2 = abs(FT/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
title('Single-Sided Amplitude Spectrum of x(n)')