Using ppval for a polynomial of two variables

1 回表示 (過去 30 日間)
wendy crumrine
wendy crumrine 2019 年 8 月 26 日
回答済み: Devineni Aslesha 2019 年 8 月 29 日
I'm trying to evaluate a piecewise polynomial (stored as a pp structure) using ppval. It seems trivial if your polynomial is just a function of one variable:
ppval(pp, xq), where xq is a list of x values at which you want to evaluate your polynomial.
But what if you have a polynomial that is a function of two variables (within the pp struction, dim = 2). I feel like xq would become a list of pairs, the (x,y) coordinates at which you want to evaluate your polynomial. But how do you input that into ppval? I've tried various ways, all giving me results I can't make sense of.
Any help would be appreciated!!
  1 件のコメント
Torsten
Torsten 2019 年 8 月 26 日
Where did you find that mkpp and ppval works for dimensions >1 ? I can't.

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

回答 (1 件)

Devineni Aslesha
Devineni Aslesha 2019 年 8 月 29 日
A piecewise polynomial that is a function of two variables cannot be evaluated using ppval. Use the given link for reference https://www.mathworks.com/help/matlab/ref/ppval.html
As a workaround, you can create a custom function with two variables as input arguments to evaluate the piecewise polynomial.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by