MATLAB Answers

0

Unspecified coefficients from function 'fit'

Daniel Stocks さんによって質問されました 2019 年 11 月 13 日 11:08
最新アクティビティ Steven Lord
さんによって 回答されました 2019 年 11 月 13 日 15:09
Hi, I'm trying to use the function 'fit' to fit a surface to a set of 3D data I have. the command I use is
sf = fit([data(:,1), data(:,2)], data(:,3), 'lowess')
where each data column is 400 elements. The function does output and I am able to plot the surface however no function or coefficients are outputted. Only
Locally weighted smoothing linear regression:
sf(x,y) = lowess (linear) smoothing regression computed from p
Coefficients:
p = coefficient structure
If I use a different fit style such as 'poly23' I do get a function and coefficients however the surface is a bad fit. I was just wondering if this our put is what I'm suposed to get from the input 'lowess' or if there is a way I can actually get a function out of this.
Thank you.

  0 件のコメント

サインイン to comment.

2 件の回答

dpb
回答者: dpb
2019 年 11 月 13 日 14:00

fit returns a fit object (either cfit or sfit, depending on curve or surface). There are functions to return things out of the object documented at <Curvefit/fit-postprocessing>, specifically the function coeffvals. You can also probe the fit object structure itself but many of these outputs are only available through the functions as the structure itself is semi-opaque.
Follow the "See Also" breadcrumbs in the documentation...it's scattered around to find all the pieces.

  1 件のコメント

Daniel Stocks 2019 年 11 月 13 日 14:19
I will look at this. Thank you

サインイン to comment.


Steven Lord
回答者: Steven Lord
2019 年 11 月 13 日 15:09

Lowess smoothing is a type of nonparametric fitting. That output appears correct. There are other methods you can use if you want to extract or interpret fit parameters.
If you want to evaluate your lowess fit for new data points that is possible using the sf object directly.
load franke
f = fit([x y],z,'lowess');
f(mean(x), mean(y))

  0 件のコメント

サインイン to comment.



Translated by