Re: Least squares fit for two parameter matrices?
- From: ellieandrogerxyzzy@xxxxxxxxxxxxxxxxxxxxxx (Roger Stafford)
- Date: Fri, 22 Jun 2007 08:28:10 GMT
In article <ef5b43c.-1@xxxxxxxxxxxxxxxxxxxxxxx>, "Urban Simoncic"
<urban.simoncic@xxxxxxxxx> wrote:
Hi,----------------------
I have m×n matrix of measurements called M, which is supposed to be
equal to product of two matrix of unknown parameter; first matrix is
called C and is m×2 and second is I and is 2×n.
Basically I have system M=C*I, which is nonlinear system of m*n
equations and 2(m+n) unknowns. Since m and n are about 100, I have
much more equations than unknowns and I would like to determine
matrices C and I by a kind of least squares fit.
Does exist any algorithm to do that? Is possible to do that in
Matlab?
Thanks in advance for any help.
Urban
I have found a way to solve your problem with C only an m by 1 column
vector and I a 1 by n row vector, if that is of any interest to you,
Urban. Unfortunately, I haven't yet found a solution to the problem you
posed with two columns and two rows, respectively. Perhaps someone else
in this group knows how to do this.
For the m by 1 and 1 by n vectors, let M be the m by n matrix, and we
wish to find C and I such that C*I is the best approximation to M in the
least squares sense. If we take the partial derivatives of phi =
sum(sum((C*I-M).^2) with respect to each element of I and set each one to
zero, we obtain
I = (C.'*M)/sum(C.^2).
Similarly, setting each of the partial derivatives of phi with respect to
elements of C to zero yields
C = (M*I.')/sum(I.^2). Substituting the I from the first equation into
the second one yields
C = 1/sum(C.^2)/sum(I.^2)*(M*M.')*C.
This last equation shows that C must be proportional to one of the
eigenvectors of A = M*M.', so this leads to the following matlab
procedure:
A = M*M.';
[U,S,V] = svd(A);
C = V(:,1); % The largest eigenvalue gives the best fit
I = C.'*M; % Take advantage of the fact that C is a unit vector
It can be shown that the mean square error is given by:
1/(m*n)*(sum(sum(M.^2))-S(1,1)),
so it is least with the largest eigenvalue, S(1,1).
Note that this solution is not unique. C can be multiplied by any
desired scalar factor provided that I is divided by the same factor, and
the approximation will be equally good.
Roger Stafford
.
- Follow-Ups:
- Re: Least squares fit for two parameter matrices?
- From: Roger Stafford
- Re: Least squares fit for two parameter matrices?
- References:
- Least squares fit for two parameter matrices?
- From: Urban Simoncic
- Least squares fit for two parameter matrices?
- Prev by Date: Re: MatLab Compiler
- Next by Date: Re: insert date in comment line
- Previous by thread: Least squares fit for two parameter matrices?
- Next by thread: Re: Least squares fit for two parameter matrices?
- Index(es):
Relevant Pages
|