Vibration Analysis by using FFT
I believe that your problem is using nextpow2 to set the fft length.  fft(x) returns a vector length(x). fft(x) is not constrained to a power of 2. If you want to set a particular size by zero padding, use fft(x,N). NFFT=length(Ax) is the actual size of DFT.

Using psd has advantages but if you use the proper size, your code will work (assuming I am correct) . Taking a single long DFT isn't an accepted way to estimate a psd, unless you are looking for very fine, high snr features.