how to get the coeffients out of a sfit object after creating it on some data using 'cubicinterp'.
6 ビュー (過去 30 日間)
古いコメントを表示
Hi, i want to fit some 3d data, and generate a mathematical description of the surface using the curve fitting toolbox. I used "cubicinterp" as the interpolation method and get the following output:
>> test = fit([X_cart,Y_cart],Z_cart,'cubicinterp','Exclude', nanz) Warning: Duplicate x-y data points detected: using average of the z values. > In curvefit.attention.Warning/throw (line 30) In curvefit.model.SurfaceInterpolantFactory/doCoalesceDuplicatePoints (line 206) In curvefit.model.SurfaceInterpolantFactory/create (line 74) In fit>iSurfaceInterpolation (line 895) In fit>iFit (line 489) In fit (line 108)
Piecewise cubic interpolant:
test(x,y) = piecewise cubic surface computed from p
Coefficients:
p = coefficient structure
I have no idea how to extract the coefficients or any kind of mathematical description out of the sfit object "test" which is generated.
Any ideas?
Thanks for any help.
Simon
0 件のコメント
回答 (2 件)
Mukul Rao
2017 年 7 月 21 日
Hi,
Here is an example that demonstrates how to extract fit coefficients from the "sfit" object:
haochen he
2018 年 11 月 30 日
I think we do not have access to the model parameters:
[fitresult, gof] = fit( [xData, yData], zData, 'cubicinterp', 'Normalize', 'on' );
names = coeffnames(fitresult); % result is: names = {'p'}
% if you try other properties like 'fitresult.others', an error will goes like:
% For the current fit, you can access these properties: p
% then we try this:
names = coeffnames(fitresult.p);
% result will be an error, if we see the fitresult.p, we can only find the property is Type='Cubic'
2 件のコメント
Antonio Machado Jorge
2023 年 10 月 17 日
It doesn't work for me... I'm on 2023b
>> fitresult.p
ans =
GriddataInterpolant with properties:
Type: 'Cubic'
>> names = fitresult.p.coefs
Unrecognized method, property, or field
'coefs' for class
'curvefit.model.GriddataInterpolant'.
Error in indexing (line 26)
out = subsref(out, subs);
参考
カテゴリ
Help Center および File Exchange で Visualization and Data Export についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!