问题
In this discussion, the result of fft is indices (0:N-1). fftshift simply converts that to [(N/2:N-1) (0:(N/2-1))].
I want to convert original range (O:N-1) to (t/N: t/N + 1), where t is time and assume integer and divisibel by N. I am using the Galois vectors as my datatype. Is this possible with built-in functions in Matlab? How can you achieve it in Matlab?
回答1:
In general, given a data
vector, if you want to shift the range from 0:N-1
to [a:N-1 0:a-1]
for some a
(0<=a<=N), you can do it very easily:
N = 10;
a = 3;
data = rand(1,N); % Example data. Assumed range: 0:N-1
shiftedData = data([a+1:N 1:a]);
来源:https://stackoverflow.com/questions/19901519/shifting-indexes-similar-to-fftshift-in-matlab-for-own-range