I wanted to fit an arbitrary function to my data set. Therefore, I used lsqcurvefit
in MATLAB. Now I want to give weight to the fit procedure, meaning when curve fitting function (lsqcurvefit
) is calculating the residue of the fit, some data point are more important than the others. To be more specific I want to use statistical weighting method.
w=1/y(x),
where w
is a matrix contains the weight of each data point and y
is the data set.
I cannot find anyway to make weighted curve fitting with lsqcurvefit
. Is there any trick I should follow or is there any other function rather than lsqcurvefit
which do it for me?