How does MATLAB do fft and ifft in matrices

조회 수: 30 (최근 30일)
Pedro Oliveira
Pedro Oliveira 2017년 10월 28일
댓글: Star Strider 2017년 10월 29일
Hi, I'm trying to do the ifft and fft of matrices, but I'm getting unexpected values.
I only don't get any error when dealing with a 1x4 matrix (which is a vector).
When putting, for example, a 2x4 matrix, I obtain and 8x4 matrix, which is not what I expected. I expected a 2x4 matrix again.
When coding the fft and ifft of the matrix, I wrote:
received_signal = fft(a,n)
transmitted signal = ifft(a,n)
where a= matrix and n= dft size (i.e. total number of elements in the matrix)
In addition, I'd like the fft/ifft to calculate the ifft and fft in a row-by-row fashion, since I'm dealing with signals so I don't want the bits to get out of order.
Thanks in advance for your help.

채택된 답변

Star Strider
Star Strider 2017년 10월 28일
The fft function computes the discrete Fourier transform on the columns (dimension 1) of a matrix, unless you tell it to compute along the rows (dimension 2).
When I do something similar, I get a Fourier-transformed matrix that is the same size as the original matrix, however complex (as expected).
If you are getting something else as a result, post your code. I suspect you are simply getting the expected complex result.
  댓글 수: 2
Pedro Oliveira
Pedro Oliveira 2017년 10월 29일
The matrix I'm inputting in the IFFT/FFT is in itself complex.
How do I make the fft function to compute along the rows? And does this take into account all the elements in the matrix or just the ones in that row? i.e. will the DFT size be the number of elements in the row or the number of elements in the matrix?
Thank you for your help.
Star Strider
Star Strider 2017년 10월 29일
My pleasure.
To get fft to compute along the rows, specify ‘2’ (the row dimension) for ‘dim’:
Fy = fft(y, NFFT, dim);
so:
received_signal = fft(a,n,2);
The fft function will compute the fft of all the rows (with the row dimension specified here) in matrix ‘a’. The same applies to the ifft function.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by