Why Doesn't pwelch with the 'centered' Option Follow the Same Convention as fftshift for Even nfft?

When the fft length is even, fftshift flips the input so that the Nyquist point is to the left. But pwelch with freqrange = 'centered' keeps the Nyquist point on the right.
The behavior in pwelch is documented, so can't complain.
Just wondering why the developers might have made that choice for pwelch (and others, like periodogram), rather than maintaining consistency.
rng(100);
x = rand(1,10);
X = fftshift(fft(x));
% this usage of pwelch is undocumented because noverlap is supposed to be
% a positive integer
[P,f] = pwelch(x,ones(size(x)),0,10,1,'centered');
figure
plot(f,P*10,'-o',(-5:4)/10,X.*conj(X),'-x')
axis padded

댓글 수: 5

@Walter Roberson, I was too lazy to post links. Any idea why @doc doesn't work in the Question pane?
For @doc to work, you need to click on the selected doc entry, not just type it in.
Yes, I do that all the time in Answers and Comments. It doesn't work for me when I'm in the Question pane. Specifically, there is no pop-up with the suggested doc entries for me to click on. Windows/Edge. As far as I recall, that feature has never worked for me in the Question pane, i.e., it's not new to the latest version of Windows/Edge.
I have now reported this to the advisory board
Thanks. Maybe the CAB can get some traction on updating the run button and the ran-in tag to 2025b.

댓글을 달려면 로그인하십시오.

답변 (0개)

제품

릴리스

R2025b

질문:

2026년 2월 7일

댓글:

2026년 2월 10일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by