how to obtain coefficients and other data from a curve fit object, of the interpolant type, using linear method?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
From a set of data, I could easily obtain a curve fit using curveFitter. The fit is of the interpolant type, using linear method. From what I understand, the underlying method is linear triangular interpolation. But then, I'm unable to get the internal data of the model. I mean, there should be triangle boundaries, coefficients and other constants describing the triangular pieces of surface that approximate my data set, but I was unable to read them from the obtained fit.
So, for this particular fit (linear interpolant), how to get the inside data?
5 comentarios
dpb
el 27 de Jul. de 2024
ADDENDUM
Totally unrelatedt the original question, but the example above illustrates the problem inherent in higher order polynomial curve fitting if not very careful -- note that the predicted pHat for the first two values are
5.5830
5.3121
whereas the corresponding input data points were
3.90
5.30
The quadratic polynomial minimum is not actually at the first/lowest point in the input data but somewhere about the 1800 year value (I didn't actually find the minimum but it's a trivial exercise to do so). The plot shows the upturn at the left end. So, prediction in that area is off signficantly even though the overall shape of the fitted line and the original data isn't too bad.
Respuestas (1)
dpb
el 29 de Jul. de 2024
Editada: dpb
el 29 de Jul. de 2024
The piecewise interpolants don't have a single set of coefficients and the object is closed for detailed inspection by design. Basically all you can do with it after creating it is evaluate it giving it the desired interpolant input coordinates.
As noted before, this is probably not the way to go for an embedded project; if your plan was to ferret out the internal workings of the MATLAB implementation so you could code it (which is probably a violation of the license in reverse engineering), you'll do better to look up the technique online and implement it directly.
The only examples given for the polynomial model probably lead to a false expectation that such data are available for any model choice, but that simply isn't so. The doc ought to make that clear that while the functions are implemented for the object, what they return is quite dependent upon the model selected; particularly for piecewise methods.
I hadn't tried to use one of these models with the sfit object so hadn't actually thought about it in those terms before (and I suspect @Steven Lord wasn't thinking about the specifics of the model itself, either, at the time he posted).
Here's < a nice explanation of barycentric coordinates that are the basis>, it doesn't give you the tessalation coordinates calculation, however. You'll probably have to use delaunay to compute them first and approach it in two steps rather than through the higher level Curve Fit TB route.
2 comentarios
dpb
el 29 de Jul. de 2024
Editada: dpb
el 29 de Jul. de 2024
I suspect it is simply owing to the volume of data and that the point was considered to be satisfied by being able to evaluate the resulting fit more than actually trying to hide the intellectual property itself. What I meant was that I think reverse engineering is against the license agreement whether there is any truly proprietary IP inside or not. And, I wasn't implying anything against your motive nor intent; simply that since Mathworks has chosen not to reveal those data it's probably not strictly kosher to get at them by subterfuge. Although I did try using Yair Altman's FEX "undocumented" utility, it doesn't know how to deal with the sfit object so wasn't of any help, either.
Again, whether this could be useful in an embedded project I'd have my doubts, anyway, even if it were available what would you do with it unless it is a fixed dataset? And, if it were that, then it would still seem more efficient to do it all offline and then just have a lookup function.
Ver también
Categorías
Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!