Hey guys, I'm trying to fit a curve with dynamic weights. For a particular point, if the fitted value > the original value, then the weight of this point is w1, otherwise, the weight of this point is w2. Usually, the weights are static(be determined before fitting), but in this case, the weights are dynamic(be determined during fitting). Is there any ideas to implement this?
I know there is a mathematical methods can be used to avoid judgment statement:
value = w1*max(fitted-original,0)^2 + w2*max(original-fitted,0)^2;
But the problem is, all the fitting functions provided by Matlab are based on least squares method:
value = (fitted-original)^2;
How can I fit a curve with the former logic instead of the latter?
Best Answer