I am trying to fit the function $A/x³$ to some data points (X,Y). I tried using least squares to fit the function $A x^3$ to the data points (1/X,Y) using least squares. However I do not obtain a good result. I though that maybe the data points need to be weighed somehow?

Here is the python function I am using right now:
def fit_params(x,y):
M = np.atleast_2d(1/x[1:]**3).T
weigth = np.diag(1/y[1:]**2).T
p, res, rnk, s = lstsq(M, y[1:])
print(res)
plt.plot(x, y, 'o', label='data')
plt.plot(x, p*x**(-3.), label='fit')
plt.show()
return p
I obtained an equally bad result when using from scipy.curve_fit but that may be because of bad initial guesses. I also tried np.polyfit and just deleting all other coefficients, but that doesn't make sense, I think. It also led to a bad result.
In case you need the full data and code, you can have a look here.
Would appreciate any query and if needed can provide further clarification.

