How to fit a polynomial to a step function??
5 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a noisy step from a scnner result. Is there any way to fit a higher order polynimial to step ? I am not sure which polynomial should work. Attached is the data and figure of my step.
0 个评论
回答(1 个)
Walter Roberson
2019-3-28
No finite polynomial can possibly fit that -- not unless perhaps you swapped axes. What you have is more like a sigmoid function.
What might be acceptable is to fit it as a ratio of polynomials. If you use cftool and select Rational, and ask for numerator order 2 and denominator order 4, the fit is not terrible. (You might have to change the degree and change back again in order to get a fit that does not have singularities.)
2 个评论
Walter Roberson
2019-3-31
That status is not an error. It says that fmincon found a place it was willing to live with. It would have preferred that the difference between adjacent locations was smaller, but it has reached the minimum step size that you configured in (by default because you pass no options) and would need to take smaller steps to reduce the slope more. You can configure options to permit it to take smaller steps, but probably it would not help.
You appear to be fitting a phased gaussian. Those are notoriously difficult to fit well. When you fit with guassians, one of the common tendencies is for the fitting to push towards a narrow peak with a high phase, which is a adaptation to fit a noise spike.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!