In the context of DFT, Where Does the Nyquist Frequency Sample Belong In a Double Sided Frequency Spectrum (Positive / Negative Side)? If we have an even number of data points $N$, after DFT in MATLAB, the output has the order:
$$(\text{DC}, f_1, f_2, \ldots, f_{N/2-1}, f_\text{Nyq}, -f_{N/2-1}, -f_{N/2-2}, \ldots, -f_1)$$
For real signals, the first output corresponding to $k$=0, is real and so is the Nyquist frequency. After that numbers are complex conjugates.
If we are interested in a single sided spectrum, the Nyquist frequency is shown on the positive side.
However, when a double-sided frequency spectrum is plotted, many authors put the Nyquist frequency on the negative side.
Some software like OriginPro, follow the opposite. Is there a fundamentally correct way or is it just a convention i.e.,
$$
\text { If } N \text { is even, } \quad k\quad\text { takes: }-\frac{N}{2}, \ldots,-1,0,1, \ldots, \frac{N}{2}-1
$$
Alternatively,
$$
\text { If } N \text { is even, } \quad k \text { takes: } -\frac{N}{2}-1, \ldots,-1,0,1, \ldots, \frac{N}{2}$$
where $k$ is the DFT index vector, which is used to construct the frequency axis as
$$\text {Frequency axis}=k/ N\Delta t$$
where $\Delta t$ is the sampling interval.
Many people say it is just a convention and both are correct. Thanks.
It's convention, they're equivalent:
$$
\exp{\left(j2 \pi \frac{N}{2}n/N \right)} 
 = \exp{\left(j2\pi \frac{-N}{2}n/N\right)} \\
\Rightarrow e^{j\pi n} = e^{-j \pi n} \Rightarrow \cos(\pi n) = \cos(-\pi n)=(-1)^n,\ j\sin(\pi n) = j\sin(-\pi n) = 0
$$
MATLAB and Numpy go $[-N/2, ..., N/2-1]$, which is unfortunate for analytic representations (+ freqs only). Note also its value is doubled relative to other bins (but not manually; they correlate this way), so in a sense it's both a negative and positive frequency, so energy's preserved:

You can tell a library's preference by fftshift docs: