Relationship between Fs (the Nyquist frequency), and the frequency used with a sine wave 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.
The sampling frequency fs is 1/dt. Conceptually, if the time between samples is $T$, then you have $1/T$ samples per second, which is the sampling frequency.

Next, you need to make sure that frequency, the sine wave's frequency, is less than the Nyquist frequency, which is fs/2.

For interpreting the spectrum (FFT_intensity), please see the answer pointed to by Matt L.