Weighting data in datafit
zugvogel
cannonjunk at hotmail.co.uk
Thu Jan 5 05:49:15 CET 2012
Hello,
I'm having a lot of trouble figuring out how to weight data-points for
fitting using "datafit".
I have:
[p,err]=datafit(G,ndata,W,p0)
The function G is:
function e=G(p, z), // output is "e", input "p" and "z"
y=z(1),x=z(2); // y is the top row, x bottom
e=y-FF(x,p), // optimise to zero, FF is my function
endfunction
ndata is 2 rows and 12 columns, the top row being y-axis values and the
bottom row being x-axis values
p0 is 4 rows and 1 column.
W is my weighting matrix. I set this initially as just a 12x12 identity
matrix.
I just can't get this to work however. I keep getting:
-------------------
-->[p,err]=datafit(G,ndata,W,p0)
!--error 15
Submatrix incorrectly defined.
at line 26 of function costf called by :
at line 174 of function datafit called by :
[p,err]=datafit(G,ndata,W,p0)
-------------------
Can anyone help me? I have tried changing W in many ways but I can't get it
to work.
The help section on datafit says W should be of size ne x ne, where G is
size ne x 1. I assume ne is the same as nz (ie, 12, the number of data
points) but maybe this is wrong? In any case I tried make ne=1,2,3...12
(always a square matrix) but without success. If I do it without weighting,
it works.
I would really appreciate any help. I'm completely out of ideas.
Thank you!
Tom
--
View this message in context: http://mailinglists.scilab.org/Weighting-data-in-datafit-tp3633921p3633921.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
More information about the users
mailing list