help-octave
[Top][All Lists]
Advanced

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

1/x fit


From: Pierrick Hanlet
Subject: 1/x fit
Date: Tue, 13 Mar 2018 17:19:01 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Hello all,
I'm using octave v4.0.3 on Fedora 25.

I have some data, call it xraw and yraw which follows a 1/x curve.
I'm attempting to minimize a function yraw-yfit, so as to get the
parameters 'p'.

function y=fitcal(p)
  global xraw yraw;
  yfit=p(1)+1.0./(p(2)*xraw);
  y = sqrt(sum((yraw-yfit).^2));
end

I'm attempting to use fminsearch, such that my call to the function is:

global xraw yraw;
...
sx=[100,0.00015];
xraw=TXI;
yraw=RXI;
[sx,fxval]=fminsearch(@(sx)fitcal(sx),sx);

Nothing that I try changes sx; i.e. the fitter always returns the initial
values
, so I'm assuming that my fit is failing.


I've successfully done something like this before with trig function.
So I'm wondering if my error is in the fact that I cannot set bounds
on p(2); namely p(2)!=0.0.

Is there something else that I'm missing?  Else, is there something
in Octave which mimicks Matlab fmincon?

Thank you,
Pierrick


--

reply via email to

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