So I am doing some some simulations with 1V sinusoidal signals, and a 1 second acquisition at sampling frequency of 100 kHz.
Now I am slowly increasing the frequency of the sinusoidal signal. Trying 1 kHz, 10 kHz, 20 kHz, 40 kHz... Everything goes as planned and the FFT produces a spectrum with a mazimum equal to 1 V (aprox.) at the frequency of the signal. However at the exact nyquist frequency, 50 kHz, the amplitude is heavily reduced and there seems to be a DC component. Is there any reason why this occurs? What is failing in the theoretical Nyquist theorem.