%
%   This example illustrates SAR interferometry.
%   First look at the phase of the reference image.  It will look
%   like random noise.  Then look at the phase of the repeat image.
%   It will also look like noise.   Finally examine the phase difference.  
%   This will show interferometric fringes across the image related
%   to the curvature if the Earth.
%
%
%   load the data files. only keep the first 800 rows
%   this is an ERS-1 to ERS-2 Tandem pair from the
%   Salton Sea,  perpendicular baseline 58 m.
%
e1=fread(fopen('22388_2925.SLC'),[5488,800],'*short','b')';
e2=fread(fopen('02715_2925.SLC'),[5488,800],'*short','b')';
%
%   make the arrays complex
%
[ni,nj]=size(e1);
ce1=complex(double(e1(:,1:2:nj)),double(e1(:,2:2:nj)));
ce2=complex(double(e2(:,1:2:nj)),double(e2(:,2:2:nj)));
%
%  make the interferogram
%
cint=ce2.*conj(ce1);
%
figure(1)
colormap('gray')
subplot(3,1,1);imagesc(angle(ce1));title('phase of image1')
axis([0,800,0,800])
colorbar
subplot(3,1,2);imagesc(angle(ce1));title('phase of image2')
axis([0,800,0,800])
colorbar
subplot(3,1,3);imagesc(angle(cint));title('phase difference')
axis([0,800,0,800])
colorbar
