I am trying to sample a sine wave and plot it's frequency components, but I am having problems implementing it.The result of taking 65536 samples of one cycle of a sine wave with max amplitude 1 and a frequency 100 can be seen below.Where the Y-axis this the magnitude of the complex Fourier sum, and the x-axis is the sample number.How can I see what frequency the sine wave has from this plot?, I would like to have a plot of freq vs Magnitude and not sample Number vs magnitude.
I was expecting one big spike of amplitude 1 or 2 spikes of amplitude 0.5 each, but I seem to be getting a large amplitude, I don't know what i might be doing wrong.
Matlab Code:
Amp = 1;
freq = 100;
dt = 2 * pi /65536;
index = 1;
for t = 0:dt:2*pi
sine(index) = Amp * sin(2*pi*freq*t);
sampleNumber(index) = index;
index = index + 1;
end
transform = fft(sine);
magTransform = abs(transform);
plot(sampleNumber,magTransform);