views:

572

answers:

2

Could anybody please tell me whether I can perform this integration with FFT in MATLAB? How? Please answer as soon as possible with the details.

Suppose there exists 2 rectangular planes, say, input accessed by x1 and y1 variables and the resulting plane is output accessed by tetax and tetay variables.

This is the integral in pseudo-code:

output(tetax,tetay)=double integral of [input(x1,y1)*exp(-j*k*((tetax*x1)+(tetay*y1)))](dx1)(dy1)

where: -1<= x1 <= 1 and -1<= y1 <= 1

tetax and tetay should change so they can span the final rectangular plane.

I would really appreciate a prompt and detailed answer.

A: 

Your problem looks like a Fourier transform, not a discrete Fourier transform (DFT). A FFT calculates the latter type of transform.

Briefly, a Fourier transform involves an integral, while a DFT involves a sum.

Managu
+3  A: 

Since this looks like homework, I'll just give some hints. The trick is to rewrite the integral to look like a normal 2D Fourier integral of a function.

There are two issues:

1) You need to combine k and your tetax, tetay to look like a normal wavenumber (and compensate for this in the appropriate way).

2) You need to deal with the limits being in the range (-1,1) whereas the Fourier integral needs them in the range (-inf, +inf). To do this, pick a function to go inside the Fourier integral that will make this work.

Then it will be obvious how to do this in Matlab. It's a cute problem and I hope this doesn't ruin it (and if people think it does, let me know and I'll delete this answer, or delete it for me if you can).

tom10
Dear Tom; thanks again for your attention. Please accept my apology but I'm new in matlab and I can't understand how I can use fft(fft(that function)) or fft2 with the k which should change in a loop. where should i take into account this? Sorry and thanks again.
Richard
I have tried to perform it with changing the k in my input function but as I have two fft and as I think changing k in the input function is not a logical task, I couldn't do it again! then I think I should change k every time and then add all the answers to have the final output on the interested plane but I can't understand where should I mention k in fft commands. please help me to understand what should I do.
Richard
@Richard - First, look at a normal 2D Fourier transform equation. You just want to make this equation look like that. Normally the term in the exponent in a 2D transform looks like x*k_x + y*k_y and you have k(tetax + tetay), so multiply each term by k, and set k_x = k*tetax and k_y = k*tetay. Then this term looks like the normal.
tom10
Dear tom; thanks a million. my problem is with matlab commands. in matlab help there are fft and fft2 but nowhere i have found the k as the input of these commands.
Richard
Richard - You're going to want to use fft2. But first you need to massage your equation so that fft2 applies to it, and that's what my hints describe, i.e. how to make your equation look like a normal 2d fourier transform. fft2 in Matlab will return a matrix, and the indices of this matrix will correspond to different wave numbers, i.e. different k_x and k_y, i.e. just like an fft always does. So 1) first modify the equation to look like a normal 2d Fourier transform (have you?), 2) read the docs of fft2 in Matlab to figure out how to interpret the result.
tom10
To be clear here, there's no looping (you mention looping in a comment). This problem is about thinking it through, not programming... your program will just be one line in Matlab taking the FFT of a properly chosen 2d function (i.e. a matrix in Matlab). Then, of course, plotting, etc.
tom10
thanks for your help, tom. it works... I had problem interpreting the results. thanks and thanks.
Richard
Richard - Great, I'm glad to hear that you got it working; I wasn't so sure it was heading in that direction a few hours ago.
tom10
Excellent answer tom10! I congratulate you on your fine pedagogy. You are a credit to the SO community.
A. Levy