With reference to chapter three,
it is required to compare the shape of the object phase, stored as
OBJ(K), with the shape of the image intensity, stored as IMAGE(K). The
mean of the OBJ(K) is zero, the function being a superposition of
cosines each of mean zero, but the image intensity has a dc bias signal.
Thus this signal is subtracted from IMAGE(K) so that both functions have
zero mean. Assuming no shift of one function relative to the other has
occured, the only difference between OBJ(K) and IMAGE(K) allowed is a
difference of scale. A scaling parameter is found from a least squares
analysis assuming the relation
| (1) |
| (2) |
| (3) |
It is necessary to perform this operation in order to recover the phase information Fn unaltered in the frequency plane. If this precaution is not taken no comparison can be made between the phase Fn of the Fourier component and the measured phase of the spectrum as determined from the real and imaginary parts of the Fourier Transform.
Chapter three shows that phase errors always occur however, so that the
measured phase q is more likely to be
| (4) |

It is thus neccessary to include an extensive series of tests to check
whether such an event has occurred, comparing recovered phase with the
quadrant of Fn etc. before the difference between the two values
can be made. The tests made in the actual simulation are detailed below.
'K' denotes which of the 50 random spectrums is being used and
'J' denotes which freq. in that spectrum we are on.
DO 200 K=1,50 !....................!Select spectrum:
PHIDEV(K)=0.0 !....................!Phase deviation for K'th
!spectrum as a whole.
DO 100 J=1,NC !....................!Cycles through frequencies.
BUGG=PHI(J)/PI !................! Actual phase of coefficient.
RUGG=(NEWPHA(J)/PI) !...........! Measured phase via ATAN2.
T1=0
T2=0
IF (BUGG.GE.0.AND.BUGG.LT.(0.5)) THEN
T1=1 !......!Phase in 1st quadrant
ELSE IF (BUGG.GE.(0.5)) THEN
T1=2 !......!Phase in 2nd quadrant
ENDIF
IF (T1.EQ.1.AND.RUGG.GT.0) THEN!...!DRUGG is actual difference
DRUGG=RUGG-0.5 !of phase after ATAN2 effects
ELSE IF (T1.EQ.1.AND.RUGG.LT.0) THEN !are accounted for.
DRUGG=RUGG+1.5
ELSE IF (T1.EQ.2.AND.RUGG.LT.0) THEN
DRUGG=RUGG+1.5
ELSE IF (T1.EQ.2.AND.RUGG.GT.0) THEN
DRUGG=RUGG-0.5
ELSE IF (BUGG.LT.0) THEN
DRUGG=RUGG-0.5
ENDIF
Y=ABS(DRUGG-BUGG) !..........! Take modulus of phase error.
IF (Y.GE.1) THEN
Y=ABS(Y-2) !..............!A catch-all, never occured in
ENDIF !any simulation once.
PHIDEV(K)=PHIDEV(K)+Y !......!Increment phase error for this
!spectrum.
100 CONTINUE
PHIDEV(K)=PHIDEV(K)/(1.0*NC)
200 CONTINUE