Make ifft2 to give real output
Show older comments
I'm trying to generate a randomly rough surface(isotropic surface). Suppose I have the absolute values of fourier components of the surface in "H" and H has symmetry with respect to center of the array. Now, I need to define some random phase for the fourier series which are between -pi to pi (due to fftshift) as in:
phi = -pi + (pi+pi)*rand(n); % random phase
Now, I don't know what to do to make the output of my surface real..
Here is the gist of the code I used so far:
[a,b] = pol2cart(phi,H);
H_complex = complex(a,b); % the complex fourier transform composed of H & phi
z = ifft2(ifftshift((H_complex)));
If I need to apply conjugate symmetry to the fourier components, how should I do it? The output is complex and I need a real surface.
Please help! Thanks a lot.
Accepted Answer
More Answers (1)
Thomas Koelen
on 20 May 2015
0 votes
use abs() or real()? depending on if you want only the real number or the absolute value.
1 Comment
Mona Mahboob Kanafi
on 20 May 2015
Edited: Mona Mahboob Kanafi
on 20 May 2015
Categories
Find more on Fourier Analysis and Filtering 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!