I try to fit some data but do not get the result I want. The problem is, that I have only few data points:
# Dosierung pH
What I want, is to create a fitting curve with the corresponding values e.g. the parameters of a cubic fitting.
I tried this with polyfit:
from pylab import *
X = load('Dosierung-pH.dat',comments="#")
x = X[:,0]
y = X[:,1]
coeffs = polyfit(x,y,4)
besty = polyval(coeffs,x)
xnew = arange(0,5,0.1)
Due to the view x-values, the curve is not a curve but a line with kinks.
xnew = arange(0,5,0.1) and
do not work, because xnew and besty have then not the same length.
The second question is, how can I get the curve values a,b,c,d out ? I would something expect like
y = a*x^3 + b*x^2 + c*x +d
printing the values for a,b,c,d for further using.