# lscov

## Purpose

Least squares solution in the presence of known covariance.

## Synopsis

    x = lscov(A,b,V)

## Description

`x = lscov(A,b,V)` returns the vector `x` that minimizes`
(A`*`x-b)'`*`inv(V)`*`(A`*`x-b)` for the case in which `length(b)` `>` `length(x)`. This is the over-determined least squares problem with covariance `V`. `V` is a square symmetric matrix with dimensions equal to `length(b)`. The solution is found without inverting `V`.

## Algorithm

The classical linear algebra solution to this problem is

     x = inv(A'*inv(V)*A)*A'*inv(V)*b

but this function computes the QR decomposition of `A` and then modifies `Q` by `V`.

## See Also

    \, nnls, qr

## Reference

G. Strang, Introduction to Applied Mathematics, Wellesley-Cambridge, p. 398, 1986.

(c) Copyright 1994 by The MathWorks, Inc.