我有一些数据:
xdata = [ 298.134 299.024 299.912 300.808 301.732 302.635 303.603 304.476
305.35 306.223 307.18 308.091 308.938 309.902 310.792 311.663
312.566 313.412 314.284 315.252 316.126 317.002 317.913 318.81
319.669 320.626 321.523 322.417 323.281 324.245]
ydata = [-9.48357662093877, -9.5792580093353656, -9.7144993201777972, -9.8715380997132574, -10.027248712603699, -10.177417977875871, -10.352374953002723, -10.517136866838991, -10.715774762340427, -10.913431451028842, -11.123817784132052, -11.345932175131191, -11.567233115011238, -11.775872934970939, -11.992878335292444, -12.21474839185972, -12.382545106102548, -12.45951145012326, -12.697558713087753, -12.870960915450144, -13.122795212623657, -13.096364398875277, -13.3741438677707, -13.323032960465998, -13.436772613480292, -13.561709556757362, -14.198404910172693, -13.896250284916482, -13.535947150817048, -14.727538560421378]
我想对这些数据进行最小二乘拟合。我想测试的函数是f(a,b,x)= -a * sqrt(b / x - 1)。我想为常数a和b找到一个很好的值,我想得到一个chi平方值的拟合。我该怎么做?