The way you call "pwelch" function is erroneous:
[pxx,f]=pwelch(calxbit, segmentLength, 0.5, nfft, fs);
When "pwelch" is called in this manner it expects the inputs to be as follows;
[pxx,w] = pwelch(x, window, noverlap, nfft, fs)
"noverlap" must be an integer less than nfft.
Regarding your question about selecting "nfft" value depends on your application/signal. I suggest to study the corresponding chapter in Stoica's spectral estimation book.