# How can I obtain the Fourier Transformation as a product of matrices?

조회 수: 3(최근 30일)
Adrian Lomeli Martin 2021년 9월 15일
댓글: Adrian Lomeli Martin 2021년 9월 15일
Hello everyone!
Before I being, I'd like to say I already know about the fft() command. My goal is to compare the resulting FT matrix obtained by it with the one obtained via Matrix Multiplication. I have the following code:
N = [0:255];
X = (2*cos(((15.8*pi)/128)*N)) + (3*sin(((27.3*pi)/128)*N));
fX = fft(X);
How can I write the values for 'X' as a vector and the other vector 'x' so that I may multiply them to get the Fourier Transformation?

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

### 채택된 답변

Matt J 2021년 9월 15일
편집: Matt J 2021년 9월 15일
N = (0:255).';
X = (2*cos(((15.8*pi)/128)*N)) + (3*sin(((27.3*pi)/128)*N));
F=fft( eye(numel(X)), [],1);
fX = fft(X); %function implementation
FX = F*X; %matrix implementation
Difference = norm(fX-FX)
Difference = 4.8302e-13
##### 댓글 수: 1표시숨기기 없음
Adrian Lomeli Martin 2021년 9월 15일
This worked perfectly! Thank you!

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

### 추가 답변(1개)

Bjorn Gustavsson 2021년 9월 15일
Have a look at the help and documentation for dftmtx. That function should return the discrete Fourier-transform matrix and give you the matrix you need. If you need to figure out how the Fourier-transform-component is an inner product between a function and a basis-function, you might gain some understanding by looking at that matrix (or its real and imaginary components) and have a think about what the matrix-multiplication does. Also just write down the integral for that Fourier-component beside the inner-product and look at how they are "similar enough". (Caveat: written by a physicist not a mathematician...)
##### 댓글 수: 1표시숨기기 없음
Adrian Lomeli Martin 2021년 9월 15일
Thank you! I checked the function you mentioned and it'll surely be useful down the line. Thank you again for taking the time to write this down.

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

R2021a

### Community Treasure Hunt

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

Start Hunting!