Main Content

Compute Forgetting Factor Required for Streaming Input Data

This example shows how to use the fixed.forgettingFactor and fixed.forgettingFactorInverse functions.

The growth in the QR decomposition can be seen by looking at the magnitude of the first element R(1,1)of the upper-triangular factor R, which is equal to the Euclidean norm of the first column of matrix A,


To see this, create matrix A as a column of ones of length n and compute R of the economy-size QR decomposition.

n = 1e4;
A = ones(n,1);

Then |R(1,1)|=||A(:,1)||2=i=1n12=n.

R = fixed.qlessQR(A)
R = 100.0000
ans = 100
ans = 100

The diagonal elements of the upper-triangular factor R of the QR decomposition may be positive, negative, or zero, but fixed.qlessQR and fixed.qrAB always return the diagonal elements of R as non-negative.

In a real-time application, such as when data is streaming continuously from a radar array, you can update the QR decomposition with an exponential forgetting factor α where 0<α<1. Use the fixed.forgettingFactor function to compute a forgetting factor α that acts as if the matrix were being integrated over m rows to maintain a gain of about m. The relationship between α and m is α=e-1/(2m).

m = 16;
alpha = fixed.forgettingFactor(m);
R_alpha = fixed.qlessQR(A,alpha)
R_alpha = 3.9377
ans = 4

If you are working with a system and have been given a forgetting factor α, and want to know the effective number of rows m that you are integrating over, then you can use the fixed.forgettingFactorInverse function. The relationship between m and α is m=-12log(α).

ans = 16

See Also