Say you are given a vector t =[...] for the time to be used to generate a sine wave of a certain frequency say FHz. I have all the data for t so I can conclude what dt is (my dt = 1d-5). Now I am to do an FFT analysis and plot magnitude vs frequency so I expect to get my original amplitude and also get back the original phase
This what I do:

```
frequency = ...; %This in Hz

dt = t(2) - t(1); %which is equal to 1d-5

fs = 2*frequency; % should this be 1/dt? or something else?

Nfft = fs;

intensity = sin(2*pi*frequency*t);

FFT_intensity =fft(intensity,Nfft)/Nfft;

magIntensity = abs(FFT_intensity);

f=linspace(-fs/2, fs/2, Nfft); 

plot(f,fftshift(magIntensity))

```

The results I get are sometimes correct and sometimes incorrect, it seems like when I chop the length of the t vector or change fs (say fs = 1/dt instead) I get the wrong amplitude ( and wrong phase, not shown here)... In general how to relate FHz, Fs and t?
I can actually include the numbers I am using if that makes any difference.
Thank you for any input.