Shifting indexes similar to fftshift in Matlab for own range

寵の児 提交于 2019-12-13 04:32:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!