NonlinearModelFit[data, Norm[{x, y} - {x0, y0}], {x0, y0}, {x, y}, Weights -> 1/observations^2]
where...
data = {{548189.217202, 5912779.96059, 93}, {548236.967784, 5912717.80716, 39}, {548359.406452, 5912752.54022, 88}, {548358.636206, 5912690.89573, 97}};
observations = {93, 39, 88, 97};
x0, y0 is my solution
The mathematica output to the above is:
FittedModel[{"Nonlinear", {x0 -> 548334.5910278788, y0 -> 5.912703316316227*^6}, {{x, y}, Sqrt[Abs[x - x0]^2 + Abs[y - y0]^2]}},
{{1/9604, 1/16900, 1/3249, 1/676, 1/900}}, {{548236.967784, 5.91271780716*^6, 98}, {548236.967784, 5.91271780716*^6, 130},
{548359.406452, 5.91275254022*^6, 57}, {548358.636206, 5.91269089573*^6, 26}, {548358.636206, 5.91269089573*^6, 30}},
Function[Null, Internal`LocalizedBlock[{x, x0, y, y0}, #1], {HoldAll}]]
Figures in bold are my x0,y0 solution.
So I am not fitting a curve but fitting to a point (with weights inversely proportional to the squared distance). I have looked around on google but am simply not sure where to start with this.
Any help with this would be very much appreciated.
So why am I doing this if mathematica does it? Well to call mathematicascript (using subprocess module) from python code is too slow for what I want to do with live data so want to try rewriting in python to see if the speed can be improved....