Evaluating polynomial at a certain x point to find y?
4 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
KSSV
2018-5-15
As you have (x,y) data in hand....you can use interpolation. Read about interp1.
iwant = interp1(x,y,1.5) ;
0 个评论
更多回答(2 个)
Torsten
2018-5-15
coeff{i} = polyfit(volHotLiq, volIce, i);
if i==4
p_15 = polyval(coeff{i},1.5);
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!