MATLAB: Error getting Fourier transform of a 1d signal

fftfourier transformMATLAB

Hello,
I have an almost-sinusoidal signal (see attached file), which I believe is composed of a mixture of maybe 2 (or 3) Fourier modes:
I wanted to verify this by plotting its Fourier transform. I expected a flat signal with a bunch of peaks at the signal harmonics. However, using fft() on the signal gives me a 2d plot that makes absolutely no sense to me. Can someone please help me to understand what is going on?

Best Answer

The easiest way to determine the location of the peaks is to use the findpeaks function (with the appropriate name-value pairs to isolate your peaks of interest). I cannot guarantee that the frequencies will be integer multiples of each other, however findpeaks is the best way to identify them.
Improve the frequency resolution by increasing the length of the fft itself. Specify an appropriately large value for ‘n’ (the second argument) to increase the frequency resolution to whatever you want.