is it possible to fit a varargin function?
2 views (last 30 days)
Show older comments
I have some discontinuous data which I want to piecewise fit all at once since there is one parameter of the fit which is common to all parts of the function. The number of discontinuities, and their places vary.
I thought about using a class and holding the discontinuity indices as a data member, and then using a member function with varying number of inputs to be the function I send to Matlab's fit function.
But apparently this does not work (varargin is empty if I use it directly inside nlfit, throws a long error message if I use it with fittype = ('funcName(x,A,B,C)')).
Any Ideas?
0 Comments
Answers (1)
Star Strider
on 7 Oct 2015
So long as all the data represent the same general relationship (the function you want to fit), the order in which they are presented to the regression function, and any discontinuities in the data, are irrelevant to the regression function. It doesn’t care.
If you want to plot your data, you obviously need to sort them by ascending values of the independent variable, but that is the only restriction.
0 Comments
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!