Re: How to invert the sigular matrix.
- From: "John D'Errico" <woodchips@xxxxxxxxxxxxxxxx>
- Date: Wed, 2 Dec 2009 09:49:01 +0000 (UTC)
"saowalak saengkae" <saengkae@xxxxxxxxxxx> wrote in message <hf4qv9$frb$1@xxxxxxxxxxxxxxxxxx>...
I want to inverse singular matrix (9x9 or 16x16) which was created from polynomial fuction. I know that it is impossible to invesre directly and althought I try to change the order of polynomail, I still can not get the answer or get just the approximated value as the matlab show:
"Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 2.124003e-018."
While pinv will solve the symptoms, it will not
actually solve the problem. The problem is one
of several things.
Your data may simply be insufficient to estimate a
polynomial of this order. If this is an interpolation
problem, it is a terrible thing to do. You should
NEVER be estimating a 15'th order polynomial
interpolant. Use a interp1 instead to build an
interpolant. Or use spline or pchip, or the splines
toolbox. Even a 9x9 matrix, which would imply
a polynomial with 9 terms, therefor an 8th order
polynomial is too large. You should almost never
use interpolating polynomials at all, when splines
are available as an option.
If this is a least squares problem, then you are
doing something almost as bad. The factthat you
are trying to form the inverse of a square matrix
means that you are using the normal equations to
solve the least squares problem! This is a very poor
way to solve the linear least squares problem!!!!!!!
That is, to solve the problem
A*x = y
where A has more rows than columns, many people
will tell you to use
x = inv(A'*A) * A' * y
This is a solution that is numerically very poor to
use when A is even remotely poorly conditioned,
and polynomial models almost always generate
poorly conditioned systems of equations. Instead,
solve the problem using either
x = A\y;
or
x = pinv(A)*y;
Either of these solutions is much more well behaved
than using the matrix inverse.
Next, very often a cause of poorly conditioned
polynomial models is the scaling of your data.
That scaling, combined with a high enough order
model, will create numerical problems in the linear
algebra. If so, then a simple prescaling of your
independent variable so that the variable is on the
order of unity will often result in a well conditioned
matrix.
A better solution anyway is to use a spline again.
High order polynomial models are again a terrible
thing to do to your data!!!! Instead, use a good
tool to build that model. A least squares spline is
such a tool. You can find a least squares spline in
the splines toolbox, or in my SLM toolbox on the
file exchange. (You will need the optimization
toolbox to use it though.) Find SLM here:
http://www.mathworks.com/matlabcentral/fileexchange/24443
Be good to your data. It deserves friendly treatment.
Use a spline.
John
.
- Follow-Ups:
- Re: How to invert the sigular matrix.
- From: Bruno Luong
- Re: How to invert the sigular matrix.
- References:
- How to invert the sigular matrix.
- From: saowalak saengkae
- How to invert the sigular matrix.
- Prev by Date: peak signal to nois ratio(psnr)
- Next by Date: matrix indexing, anti-index
- Previous by thread: Re: How to invert the sigular matrix.
- Next by thread: Re: How to invert the sigular matrix.
- Index(es):
Relevant Pages
|