0

I have an array of numbers in variable "filter". I wanted to compute Fourier Transform (fft) on every 32 data consecutively using matlab. But the codes below doesn't seems to work. Anyone have a better solution?

for aa=1:length(filter)-32  %scans every row of numbers
 output(aa) = fft(filter(aa + (0:31)));   % compute fft every 32 data continuously      
end
ActiveUser
  • 39
  • 2
  • 5
  • As `aa` is a single number, `output(aa)` won't be able to hold the output of `fft`. – nkjt Mar 18 '14 at 09:09

1 Answers1

1

If memory space is not a problem, you can use the im2col function. The following code rearranges every [1, 32] block in your input array into a column of the output array. The fft function in the second line applies on each column independently.

x = im2col(filter, [1, 32]);
output = fft(x);
shaoyl85
  • 1,854
  • 18
  • 30