# Targeting Matrix

A technique employing knowledge at the intersection of linear algebra and statistics.

## Idea

Using projections, as described in linear algebra, it's possible to map an n-dimensional matrix, A, to a vector, b, via a third vector, x, such that Ax=b.

## Example

Consider we wanted to simply devise a matrix that would map distance to a firing angle. In order to do this, we might create an 3-dimensional matrix, with values `A = [x^2, x, 1]` for every x that we record, where x is the distance to our target at the time of firing, and a second vector, `b = [y]` where y is the correct firing angle. After acquiring three data points, we'll be able to arrange our vectors in the form Ax=b, as such:

```A = [[a^2, a, 1], [b^2, b, 1], [c^2, c, 1]] ```

```x = [unknown1, unknown2, unknown3] ```

`b = [[angle_a], [angle_b], [angle_c]]`

Now we wish to solve for x. To do this, we project A onto b. Therefore, we first multiply both sides of the equation by $A^T$ to get:

$A^T * A * x = A^T * b$

And then multiply by the inverse of $(A^T * A)$ to reach $x = (A^T * A)^{-1} * A^T * b$. We now can compute x.

With x, it is possible to map distances to targets to firing angles, via simply inputing distance into the function:

$f(x) = unknown_1 * x^2 + unknown_2 * x + unknown_3 * 1 = angle$

Notice that the projection matrix, $(A^T * A)^{-1} * A^T$, was used to compute x rather than simply $A^{-1}$. This is because by using the projection matrix it is possible to compute x for any number of tuples. This is extremely useful since the alternative is to use a polynomial of dimension $n$ to fit a line through all of the $n$ data points.

This idea is also extremely powerful because it simplifies segmentation- in order to track another factor one simply appends a vector to A. For example, if one wanted to additionally track target velocity, one would simply append another vector to A, such that:

`A = [[v, a^2, a, 1], [v, b^2, b, 1], [v, c^2, c, 1]]`

where v is the target velocity. (x in this case would also need another element).

v  d  e
Quick
Statistical
Log-Based
Heuristics
Hybrid
Firing Angle
Energy
Terms
Related