how to obtain coefficients and other data from a curve fit object, of the interpolant type, using linear method?

3 次查看(过去 30 天)
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 个评论
dpb
dpb 2024-7-27
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.
Fabrice Belveze
Fabrice Belveze 2024-7-29
Hello, please read my post again: " The fit is of the interpolant type, using linear method". It is in this particular case that I can't read the fit's inside data.
Like you, I don't have any problem if I use a polynomial fit.

请先登录,再进行评论。

回答(1 个)

dpb
dpb 2024-7-29
编辑:dpb 2024-7-29
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 个评论
Fabrice Belveze
Fabrice Belveze 2024-7-29
Thanks for your detailed explanation.
I never intended to violate any intellectual property of mathworks. But in my maybe naive opinion, the know-how of Matlab is how to find the (multiple) sets of coefficients from a data set. I don't understand why the coefficients sets (and probably along with triangle boundaries) are masked to the user, I don't see the point with intellectual property here.
Anyway, I understand that this is closed to the user, and I will have to find another way to approximate my data set with triangles. Thanks a lot for the suggestion to Delaunay matlab function, I didn't know that was available.
dpb
dpb 2024-7-29
编辑:dpb 2024-7-29
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by