help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

leasqr and anonymous functions


From: Nose Nada
Subject: leasqr and anonymous functions
Date: Tue, 29 Apr 2008 19:58:48 -0700 (PDT)

Hello there!

I have defined an anonymous function Error with three parameters (SD(1:3))
and an independent variable p:

octave:1> SDc = 0.0001; R=1000;
octave:2> Error = @(SD,p)(SDc^2 + ((1/(R-1) + p).^2)*(SD(1)^2) +
(((p./((2*(SD(3)^1.5) + 0.6))).*log(1+(10^SD(3)).*(1-p))).^2).*(SD(2)^2));

It worked fine on evaluation:

octave:3> Error([0.01 0.01 1], 0:0.1:1) 
ans =

   1.0100e-08   1.8144e-06   6.9068e-06   1.4827e-05   2.5052e-05  
3.6983e-05   4.9925e-05   6.3081e-05   7.5597e-05   8.6947e-05   1.0021e-04

However, when I tried to fit it to experimental data using 'leasqr', it
fails:

octave:4> leasqr((0:0.1:1)',(0.001:0.001:0.011)', [0.01 0.01 1], Error)
error: operator -: nonconformant arguments (op1 is 11x1, op2 is 3x1)
error: evaluating binary operator `-' near line 182, column 9
error: evaluating binary operator `.*' near line 182, column 5
error: evaluating assignment expression near line 182, column 2
error: called from `leasqr' in file
`/usr/share/octave/packages/optim-1.0.0/leasqr.m'


What could be the problem?
Thanks in advance,
Omar



-- 
View this message in context: 
http://www.nabble.com/leasqr-and-anonymous-functions-tp16974766p16974766.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]