inverse Fourier transform

hi,
I have a matrix 120x200 called H. inside H, there are some data like x+iy. I'd like to take inverse Fourier of H, I tried to use, ifft command but it takes only one dimensional inverse Fourier. What command should I use or what code should I use to take inverse Fourier of a 120x200 matrix. Thank you

1 Comment

salih
salih on 10 Feb 2011
I also wrote a code to take inverse fourier of a matrix 120x200 size. is something wrong with the code
function out = invf(H)
for t=1:120
for tao=1:200
b=zeros(120,200);
for f=1:201
b(t,tao) = b(t,tao)+ H(t,f)*exp(1i*2*pi*(5099+f)*tao*10^-3);
end
k(t,tao)= b(t,tao);
end
end
out = k(:,:);

Sign in to comment.

 Accepted Answer

Look at the dimensions of your z matrix. (size(z)). Then make sure the number of x values matches the first dimen
Consider:
a = rand(3,4);
[nrows,ncols] = size(a); %Careful with this syntax if you
% have higher dimensions!
THIS WORKS:
surf(1:ncols,1:nrows, a)
BUT THIS DOESN'T:
surf(1:nrows,1:ncols, a)
Cheers,
Brett

1 Comment

salih
salih on 10 Feb 2011
thank you buddy, it was very helpful I solved my problem :)

Sign in to comment.

More Answers (2)

David Young
David Young on 10 Feb 2011

0 votes

ifft2

2 Comments

salih
salih on 10 Feb 2011
thank you very much David for your help. can you also help me on that.
I'd like to plot 3D of inverse fourier transform. I use the following commands
x=1:120
y=1:200
z=ifft2(H(:,:))
surf(y,x,abs(z))
but I get following error
??? Error using ==> surf at 78
Data dimensions must agree.
Could you tell me how to correct it ?
See comment on next "answer"

Sign in to comment.

salih
salih on 10 Feb 2011

0 votes

I'd like to plot 3D of inverse fourier transform. I use the following commands
x=1:120;
y=1:200;
z=ifft2(H(:,:));
surf(y,x,abs(z))
but I get following error
??? Error using ==> surf at 78 Data dimensions must agree. Could you tell me how to correct it ?

2 Comments

salih
salih on 10 Feb 2011
no suggestion ?
Try
surf(x, y, abs(z))
Remember that the length of x must be the number of columns of z, and the length of y must be the number of rows.

Sign in to comment.

Categories

Find more on Graphics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!