From: Eiffel on
i hava some questions about the program below。after“ phi3=ifft2(PH);”,i get a complex martix ,but i need a martix equal peaks(200)*3,not a complex one.so i think i need do some before iff2. how should i do? or if i need modify somewhere?
thank you for reading my question~


phi0=peaks(200)*3;
figure
imagesc(phi0)
phi=angle(exp(j*phi0));
[m,n]=size(phi);
phi1=zeros(2*m-1,2*n-1);
phi1(1:m,1:n)=phi;
phi1(m+1:2*m-1,1:n)=phi(m:-1:2,:);
phi1(1:m,n+1:2*n-1)=phi(:,n:-1:2);
phi1(m+1:2*m-1,n+1:2*n-1)=phi(m:-1:2,n:-1:2);
figure
imagesc(phi1)
phidx=zeros(2*m-1,2*n-1);
phidy=zeros(2*m-1,2*n-1);
phidx(1:2*m-2,:)=angle(exp(j*(phi1(2:2*m-1,:)-phi1(1:2*m-2,:))));
phidy(:,1:2*n-2)=angle(exp(j*(phi1(:,2:2*n-1)-phi1(:,1:2*n-2))));
lou=zeros(2*m-1,2*n-1);
loudx=zeros(2*m-1,2*n-1);
loudy=zeros(2*m-1,2*n-1);
loudx(2:2*m-1,:)=phidx(2:2*m-1,:)-phidx(1:2*m-2,:);
loudy(:,2:2*n-1)=phidy(:,2:2*n-1)-phidy(:,1:2*n-2);
lou=loudx+loudy;
PP=fft2(lou);
for ii=1:2*m-1 ii
for jj=1:2*n-1
k1=2*cos((ii)*pi/(m));
k2=2*cos((jj)*pi/(n));
PH(ii,jj)=PP(ii,jj)/(k1+k2-4);
end
end
phi3=ifft2(PH);
phi3=phi3(1:m,1:n);
figure
imagesc(real(phi3))