AN-1258
GRADIENT DESCENT ALGORITHM TERMINATING
CONDITIONS
The gradient descent algorithm continues to iterate until either
a minimum has been found or until one is satisfied that a
minimum cannot be found.
The first terminating condition is that a minimum has been
found. This is realized by keeping a variable (best) which stores
the lowest image power measured and the coordinates at which
it was measured.
In each iteration of the algorithm, a new center, Point A, is
chosen. If the image power measured at Point A is lower than
the existing best value, then Point A becomes the new best value
and best is updated with the value and coordinates of Point A.
START
SET IR CALIBRATION VALUES
FOR POINT A
MEASURE RSSI
SET IR CALIBRATION VALUES
FOR POINT B (GAIN + 1)
MEASURE RSSI
SET IR CALIBRATION VALUES
FOR POINT C (PHASE + 1)
MEASURE RSSI
CALCULATE ΔGAIN, ΔPHASE
Figure 9. Gradient Descent Algorithm Flowchart
Rev. 0 | Page 10 of 12
ΔPHASE >
YES
(ΔGAIN + 2)?
NO
YES
NO
ΔGAIN > 0?
INCREMENT
DECREMENT
GAIN
GAIN
ΔGAIN >
YES
(ΔPHASE + 2)?
NO
YES
NO
ΔPHASE > 0?
INCREMENT
DECREMENT
PHASE
PHASE
REACHED
NO
TERMINATING
CONDITIONS?
YES
END
If the value of Point A is no better than the existing best, then
it is a suboptimal calibration point and a counter, labeled
suboptimal, is incremented. If this counter reaches a threshold
(x), then x points to the point in best that failed to improve
upon the calibration. In this case, the point stored in best
is deemed to be the optimal solution and iterations of the
algorithm cease. It is recommended to set the maximum
allowable value of the suboptimal counter to 5.
For every iteration of the algorithm, an iteration counter is
incremented. If this counter exceeds a large number, a unique
optimal point cannot be located and the algorithm is
terminated. The value stored in best is the optimal point. It
is recommended to set the maximum allowable value of this
counter to 50.
These steps are outlined in the flowchart in Figure 10.
Application Note
Need help?
Do you have a question about the AFDF7021 and is the answer not in the manual?