# sfit object. can't get coefficients.

6 ビュー (過去 30 日間)
almaz ham 2015 年 3 月 3 日
コメント済み: maitehar 2020 年 6 月 8 日
Hello. There is my code:
>> c = fit( [X, Z], Y, ft, opts );
>> c
Linear interpolant:
c(x,y) = piecewise linear surface computed from p
where x is normalized by mean 0.5 and std 0.2745
and where y is normalized by mean 227.7 and std 80.16
Coefficients:
p = coefficient structure
>> class(c)
ans =
sfit
>> coeffvalues(c)
ans =
TriangleSurfaceInterpolant with properties:
Type: 'Linear'
>> c.p
ans =
TriangleSurfaceInterpolant with properties:
Type: 'Linear'
>> c(0.3, 201)
ans =
26349
Is it possible to get coefficient of
c() function?

サインインしてコメントする。

### 回答 (3 件)

Greig 2015 年 3 月 3 日
As Sean de Wolski points out in the question that you linked to, a interpolated surface fit has multiple sets of linear fit coefficients, one for each point in the data.
If you want to have just a single set of coefficients for the entire surface fit you will need to use a polynomial fit. For example, if you want to use a 2nd order polynomial in both x and z, set the fittype to 'poly22'. The c.p00, c.p10, c.p01, c.p11, c.p20, c.p02 will contain all of your coefficients.
If this is not what you are looking for could you gives us some more details about what your are wanting.
##### 4 件のコメント2 件の古いコメントを表示2 件の古いコメントを非表示
maitehar 2020 年 6 月 8 日
Hello, reading this because is in the direction of what I want.
What if I want those coeficients,from a linear fit, for each fitted interval?
This is just because, by a linear fit, it simplifies a lot some calculations and allows me to propose an easy analitycal solution in my study.
Any ideas?
maitehar 2020 年 6 月 8 日
Ah, got it! I'lll leave it here just in case someone checks this later:
The structure with all coeficient values from a linear fit is called:
your_fit_name.p.coefs
cheers,

サインインしてコメントする。

almaz ham 2015 年 3 月 3 日
##### 0 件のコメント-2 件の古いコメントを表示-2 件の古いコメントを非表示

サインインしてコメントする。

almaz ham 2015 年 3 月 3 日
How implement it in embedded code?

サインインしてコメントする。

### カテゴリ

Help Center および File ExchangeFit Postprocessing についてさらに検索

### Community Treasure Hunt

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

Start Hunting!

Translated by