Can I get the mathematical expression of an interpolation?

3 ビュー (過去 30 日間)
Jaime De La Mota Sanchis
Jaime De La Mota Sanchis 2021 年 10 月 8 日
コメント済み: Steven Lord 2021 年 10 月 9 日
Hello everyone. I am working with interpolated data.
I want to obtain the mathematical expression of the interpollating polynomial. I have written
sfX1 = fit([positions(:,1), positions(:,2)],windX_in_the_node_vector,'poly34')
And the output returns the linear model poly which is what I am looking for, f(x,y)=a*x^3+b*y^3+...
However, I would be interested in using other kinds of interpolations. I have tried linear, lowess, linearinterp, cubicinterp and nearest and instead of poly34. Unfortunately, instead of a polynomial such as the one in poly34, the code returns
Linear interpolant:
sfX2(x,y) = piecewise linear surface computed from p
Coefficients:
p = coefficient structure
and so on. Is there a way for me to obtain the mathematical expressions as the ones in poly34?
Best regards.
Jaime.
  2 件のコメント
Walter Roberson
Walter Roberson 2021 年 10 月 8 日
For piecewise fits, the mathematical expressions would have to be written in terms of heaviside() or similar functions. Would that even be useful to you?
At the moment I am not aware of any function to convert piecewise fits to heaviside, but I believe it would be possible to write such a function... but is it worth doing?
Jaime De La Mota Sanchis
Jaime De La Mota Sanchis 2021 年 10 月 8 日
Hello. I think that would be very useful to me, as I feared, it seems like even if it can be done, a lot of work should be put in it.

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

採用された回答

Steven Lord
Steven Lord 2021 年 10 月 8 日
編集済み: Steven Lord 2021 年 10 月 8 日
Are you looking for a mathematical expression for the fitted model or do you just want to be able to evaluate the fitted model at new points? In the former case, how were you hoping to use such an expression? If the latter case, that's easy.
load census
f = fit(cdate, pop, 'linear', 'Normalize', 'on')
f =
Linear interpolant: f(x) = piecewise polynomial computed from p where x is normalized by mean 1890 and std 62.05 Coefficients: p = coefficient structure
plot(cdate, pop, 'r-+', 1977, f(1977), 'ko') % Evaluate f in 1977
Looks like a pretty good match.
  4 件のコメント
Jaime De La Mota Sanchis
Jaime De La Mota Sanchis 2021 年 10 月 8 日
I want to send it to another computer where pyomo, an optimizator made in python is used. I have sent the coefficients to said optimizator, but the result is numerically unfeasible.
Steven Lord
Steven Lord 2021 年 10 月 9 日
The MATLAB Engine API for Python may be of interest to you.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by