0

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?

Community
  • 1
  • 1
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697

1 Answers1

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]);
Luis Mendo
  • 110,752
  • 13
  • 76
  • 147
  • Can you reach ranges from (0:N-1) to (t/N: t/N + 1) with this technique? – Léo Léopold Hertz 준영 Nov 13 '13 at 19:54
  • Let's take an example: N = 5, t = 1. What do you mean by "1/5: 1/5+1"? You should define a step less than 1, otherwise that index set only contains two elements: 1/5 and 1/5+1. For example, "1/5:.3:1/5+1" gives the set of [.2 .5 .8 1.1]. Now if you want to move from 0:4 to [.2 .5 .8 1.1], that's not indexing, that's interpolation. You should use `interp1` for that – Luis Mendo Nov 13 '13 at 21:52
  • I can define "1/5:.01:1/5 + 1" so 0.4 not a problem. If I take every real value between the range, then there is no need for interpolation, I think. I am not sure. – Léo Léopold Hertz 준영 Nov 13 '13 at 22:32