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!