defines the frequency vector for a two-sidedfft, where0 Hz is in the centre of the plot. Here,‘Fs’ is the sampling frequency, undefined in the code you posted (but is probably1/Ts).
I found the solution, I didn't post the frequency of sampling. But apparently fftshift just swaps X axis and then if there were no 0 between samples they get joined. So I had to add zeroes to the fft result in order for the fftshift to work properly, this is by extending the sampled rate of the original function. (Making sampling frequency higher extends repeating time in frequency domain vice versa making sampled range larger adds samples to the frequency domain in between the existing samples.)
Best Answer