help-octave
[Top][All Lists]

Re: Leasqr matrix singular to machine precision

 From: Rolf Fabian Subject: Re: Leasqr matrix singular to machine precision Date: Wed, 27 Feb 2008 01:25:55 -0800 (PST)

Archambault Fabien wrote:
>
> The new system is OH : O--r--H
> VAL = [ 0.224500; 1.768200; -0.046000; -0.152100 ];
> E = [ -0.07448954353324, -0.08360628927338, -0.07754889023817,
> -0.06687445777949, -0.05579235670778, -0.04583105820141,
> -0.03740142179587, -0.03047055087209, -0.02485135363035,
> -0.02032381096457, -0.01668232871251, -0.00560089027582,
> -0.00253765775795, -0.00125663617346, -0.00066901215928 ];
> R = [ 1.9; 2; 2.1; 2.2; 2.3; 2.4; 2.5; 2.6; 2.7; 2.8; 2.9; 3.5; 4; 4.5; 5
> ];
> function y = f(r,x)
>     y = sqrt(x(3) * x(4)) * ( ( (x(2)+x(1)) ./ r(:,1) ).^12 - 2 * (
> (x(2)+x(1)) ./ r(:,1) ).^6);
> endfunction
> [f1,result,kvg,iter] = leasqr(R,E,VAL,"f",0.00001)
>
> The output is :
> warning: in
> /usr/lib64/octave/2.1.73/oct/x86_64-mandriva-linux-gnu/inv.oct near line
> 298, column 8:
> warning: inverse: matrix singular to machine precision, rcond =
> 3.83891e-18
> f1 =
>

I suggest that you should read help part of 'leasqr' more carefully.
Doing that, you'll get

|function [f,p,kvg,iter,corp,covp,covr,stdresid,Z,r2]=
|                 leasqr(x,y,pin,F,{stol,niter,wt,dp,dFdp,options})
|
|Levenberg-Marquardt nonlinear regression of f(x,p) to y(x).
|
|Version 3.beta
|Optional parameters are in braces {}.
|x = column vector or matrix of independent variables, 1 row per
|  observation: x = [x0 x1....xm].
|y = column vector of observed values, same number of rows as x.   (*)
|...

Thus, first arg needs to be a column vector
(your 'R', which you've specified correctly as a column as requested).

But you've specified the 2nd argument ('E') as a row -vector, which
collides with (*) above, because 'leasqr' expects the same number
of rows as R.

Probably

[f1,result,kvg,iter] = leasqr (R, E.', VAL, "f")

using transposed vector E as 2nd arg to leasqr matches

Rolf

-----
Rolf Fabian
<r dot fabian at jacobs-university dot de>

--
View this message in context:
http://www.nabble.com/Leasqr-matrix-singular-to-machine-precision-tp15586584p15709349.html
Sent from the Octave - General mailing list archive at Nabble.com.

reply via email to