Hi all, so I have a script that evaluates the 1st through 4th degree polynomials of a given dataset of volume of liquid vs vol. of ice. I already did everything and plotted it just fine, the only thing I want to do is evaluate it for when x = 1.5 (vol. of liquid) for the 4th degree polynomial.
What I wanted/tried to do is just evaluate the anonymous function, but it's within the for-loop and I don't know to pull the 4th iteration so I can evaluate it at 1.5. Any tips?

 採用された回答

KSSV
KSSV 2018 年 5 月 15 日

1 投票

As you have (x,y) data in hand....you can use interpolation. Read about interp1.
iwant = interp1(x,y,1.5) ;

その他の回答 (2 件)

Torsten
Torsten 2018 年 5 月 15 日

1 投票

coeff{i} = polyfit(volHotLiq, volIce, i);
if i==4
p_15 = polyval(coeff{i},1.5);
end
Emanuele Joy
Emanuele Joy 2018 年 5 月 15 日

0 投票

You're golden. I keep forgetting when to use the interp1 function. Thank you so much!

カテゴリ

ヘルプ センター および File Exchange で Polynomials についてさらに検索

質問済み:

2018 年 5 月 15 日

回答済み:

2018 年 5 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by