Hi,

I'm quite new to this and so I'm currently struggeling a little bit with using "minlmcreatevj".

I want to fit a circle to a number of points. P(x,y)

I want to minimize the function: SUM[ ((xi-a)^2 + (yi-b)^2 - r^2)^2 ]

The documentation says, that i have to split it in single function f[0]^2+f[1]^2+f[2]^2

I'm not sure if I did this right so here are my functions:

**Code:**

public static void function1_fvec(double[] x, double[] fi, object obj)

{

// m_x = x-coordinate of center

// m_y = y-coordinate of center

// r = radius of circle

// x = x-coordinate of point

// y = y-coordinate of point

fi[0] = Math.Pow(x - m_x, 2);

fi[1] = Math.Pow(y - m_y, 2);

fi[2] = -Math.Pow(r, 2);

}

public static void function1_jac(double[] x, double[] fi, double[,] jac, object obj)

{

// m_x = x-coordinate of center

// m_y = y-coordinate of center

// r = radius of circle

// x = x-coordinate of point

// y = y-coordinate of point

fi[0] = Math.Pow(x - m_x, 2);

fi[1] = Math.Pow(y - m_y, 2);

fi[2] = -Math.Pow(r, 2);

jac[0, 0] = -2 * (x - m_x);

jac[0, 1] = 0;

jac[0, 2] = 0;

jac[1, 0] = 0;

jac[1, 1] = -2 * (y - m_y);

jac[1, 2] = 0;

jac[2, 0] = 0;

jac[2, 1] = 0;

jac[2, 2] = -2 * r

}

But I don't understand, where I can input my points. Otherwise he wouldn't know to what points he should fit the circle.

I'm using C#.

I'm a little bit confused and I hope, that you could help me with my problem how this library actually works.

Best regards

Dominik