Matrix must be positive definite. Fit.PolynomailWeighted


(Eduard) #1

Hi everyone.
I’m using the method Fit.PolynomialWeighted() to interpolate a set of points where each points has its own weight. The data I’m using is the following:

xs;ys;ws
37747;0.36083865622578;0.99909942360515
37748;0.322406927332496;0.999267756924382
37749;0.323716492503407;0.999413696669535
37750;0.345244140364006;0.999538837307928
37753;0.377662559799022;0.999805429695319
37754;0.383248256140257;0.999863344417809
37755;0.353248523398455;0.999908450059564
37756;0.366464441296737;0.999942346907922
37757;0.364219472432317;0.99996663567195
37760;0.308242242830799;0.999997864660776
37761;0.291765774915146;0.999999733082431
37762;0.289119918753508;1
37763;0.335422401582168;0.999999733082431
37764;0.337680733356496;0.999997864660776
37768;0.396196915840393;0.999942346907922
37769;0.414330384584547;0.999908450059564
37770;0.440267792714541;0.999863344417809
37771;0.45184007269423;0.999805429695319
37774;0.433880321778871;0.999538837307928
37775;0.456944704278804;0.999413696669535
37776;0.503487719485795;0.999267756924382
37777;0.513429724456798;0.99909942360515

I’m calling the method as follows:

double[] polynomial = Fit.PolynomialWeighted(
x: xs,
y: ys,
w: ws,
order: 2);

The exception I’m getting is the following:
Additional information: Matrix must be positive definite.

What am I doing wrong?

thank you for your time! :slight_smile: