Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Strange object position after IFFT2
Replies: 3   Last Post: Dec 27, 2012 6:39 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Wojtek

Posts: 8
Registered: 5/7/12
Re: Strange object position after IFFT2
Posted: Dec 27, 2012 1:41 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I think I start to understand where is the problem. The whole thing concentrates in this simple piece of code which I prepared as an example:

clear all
clc

a = [zeros(1,412) ones(1,200) zeros(1,412)];
adft = fftshift(fft(a)) ;

my_spectrum = zeros(1024,1024);
for k=1:1024
my_spectrum(k,k) = (adft(k)) ;
end
recon = (ifft2(ifftshift(my_spectrum))) ;
imagesc(abs(recon)) ;

I calculated 1D FFT of a square function. I placed in in the diagonal of my empty spectrum. The result (the reconstructed image "recon") should be (in my opinion) one square function going diagonally through the center. So why as a result I get two rectangular functions - not one?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.