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.