Make ifft2 to give real output
显示 更早的评论
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.
采纳的回答
更多回答(1 个)
Thomas Koelen
2015-5-20
0 个投票
use abs() or real()? depending on if you want only the real number or the absolute value.
1 个评论
Mona Mahboob Kanafi
2015-5-20
编辑:Mona Mahboob Kanafi
2015-5-20
类别
在 帮助中心 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!