Lsqcurvefit parameter problem for high degree polynomials

I have a problem with lsqvurvefit. When I try to find the appropriate parameter of a problem defined as:
G is a known function for any t.
S is unknown function so I approximate it as a polynomial with 10 degree.
alpha is a unknown parameter. (I am looking for this parameter)
The relation between them is G=a*S.
I introduced this problem to lsqcurvefit. From where I stand I think that the objective is to optimize 12 parameters including a and parameters of polynomial to minimize the error function. When I start the code it finds a value for the parameter a. But it is nonsense. Moreover, when I plot the function G and a*S (after lsqcruvefit found the parameters) seperately they are so much different. So, I decided to increase the degree of the polynomial but nothing changes. Lsqcurvefit cannot fit a*S properly to G.
I couldn't find the reason for this.

 采纳的回答

A degree 10 polynomial has 11 degrees of freedom if the leading coefficient (in this case "a") is treated as unknown. So over-parametrizing with 12 unknowns could explain why the value of "a" you're getting is nonsense.
Aside from that, however, high order polynomial fitting is an ill-posed problem. Degree 10 is about at the edge of what double precision can handle. You should probably consider a different approximation model.

4 个评论

If you are going to use a polynomial model, an iterative solver like lsqcurvefit is also probably not a good idea. You should just use polyfit().
Thank you very much for your answer. I acknowledge that a 10 degree polynomial has 11 unknown but aside from that I have the "a" parameter. So, in total I have 12 parameter. The structure I think is like a*(x1 + x2* t + x3*t^3 + ....+ x11*t^10).
I am trying to solve a set of ODE's with Runge Kutta 4 and I need this parameter "a" to run the numerical approximation (also this S is a funciton in these set of ODE's). So, I thought for short distances like 40-60 unit time t, I could use a polynomial approximation. What should I use instead to approximate the function S?
So, in total I have 12 parameter. The structure I think is like a*(x1 + x2* t + x3*t^3 + ....+ x11*t^10).
Multiplying a polynomial by a scalar simply produces another polynomial. You haven't expanded the family of functions by multiplying with "a". You've just added redundant parameters which make the fit non-unique.
What should I use instead to approximate the function S?
Perhaps a cubic spline fit?
I understand the problem you are indicating. But I need to have the value of parameter "a" distinctnly from other parameters. If I do not introduce 12 parameters, the solution will not involve the value of a seperately. What am I supposed to do?
Again, thank you very much.

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by