From: Michalis on
Hi,
I'm trying to make a function where I somewhere use least squares with the command:
b = pinv(A) * B
I already know the true b vector and the estimated A matrix is the same as the true A matrix but some results of the estimated b are far away from the true. A is a very ill-conditioned matrix (rcond(A) gives me near 0) and it looks like the SVD method matlab uses for pinv fails in my situation. Is there a better way to estimate pinv or alternatively use any other method instead of least squares?
From: Bjorn Gustavsson on
"Michalis " <micpan84(a)gmail.com> wrote in message <i1hhpv$q7v$1(a)fred.mathworks.com>...
> Hi,
> I'm trying to make a function where I somewhere use least squares with the command:
> b = pinv(A) * B
> I already know the true b vector and the estimated A matrix is the same as the true A
> matrix but some results of the estimated b are far away from the true. A is a very
> ill-conditioned matrix (rcond(A) gives me near 0) and it looks like the SVD method matlab
> uses for pinv fails in my situation. Is there a better way to estimate pinv or alternatively
> use any other method instead of least squares?
>
I suggest that you do the SVD and then do either damped least square or truncated least square. If that is not enough you could try Tichonov type regularization, or perhaps Backus-Gilbert.

HTH,
Bjoern
From: Bruno Luong on
"Bjorn Gustavsson" <bjonr(a)irf.se> wrote in message <i1hjg8$av5$1(a)fred.mathworks.com>...

> >
> I suggest that you do the SVD and then do either damped least square or truncated least square.

The PINV command does exactly that, OP might need to adjust the second parameter which is the tolerance for truncating.

Bruno
From: Greg Heath on
On Jul 13, 7:14 am, "Michalis " <micpa...(a)gmail.com> wrote:
> Hi,
> I'm trying to make a function where I somewhere use least squares with the command:
> b = pinv(A) * B
> I already know the true b vector and the estimated A matrix is the same as the true A matrix but some results of the estimated b are far away from the true.  A is a very ill-conditioned matrix (rcond(A) gives me near 0) and it looks like the SVD method matlab uses for pinv >fails in my situation..

Please explain exactly what you mean by that.

>Is there a better way to estimate pinv or alternatively
> use any other method instead of least squares?

I don't think regularization will be much better than
truncated pseudoinversion.

How are you truncating your singular values?

Do you know the physical reason why your matrix is
ill-conditioned?

What is your original physical problem?

What is the size of A?

Hope this helps.

Greg
From: Bjorn Gustavsson on
"Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <i1hnlc$qn$1(a)fred.mathworks.com>...
> "Bjorn Gustavsson" <bjonr(a)irf.se> wrote in message <i1hjg8$av5$1(a)fred.mathworks.com>...
>
> > >
> > I suggest that you do the SVD and then do either damped least square or truncated
> > least square.
>
> The PINV command does exactly that, OP might need to adjust the second parameter
> which is the tolerance for truncating.
>
> Bruno
>
Yes, but when I solve mixed-determined linear problems I know that I'm on so numerically thin ice that I need to see what is actually going on. If the OP learns to roll his own TLSQ he should also be able to do stuff such as setting the threshold adaptively with some tests of the statistical properties of the residuals (for example are the residuals consistent with the solution being expected values for the given observations), or combine TLSQ and DLSQ.

That pinv black-boxes the solution of under-determined problems makes it my least favourite matlab function.

Bjoern