Finding domain and range with polyfit/polyval

6 ビュー (過去 30 日間)
Joshua Wille
Joshua Wille 2021 年 1 月 17 日
編集済み: Matt J 2021 年 1 月 17 日
I have coefficients to an 17th order polynomial that fits my data well. When I zoom into the graph from y=0 to y=15 this is what I see. I want MatLab to tell me the time it takes the top curve to go from y=0 to y=15.
Someone told me to use polyval(coef,15) - polyval(coef,0) But that gave me 5.9235e+09 when it should be something like 3.8 seconds.

回答 (1 件)

Matt J
Matt J 2021 年 1 月 17 日
編集済み: Matt J 2021 年 1 月 17 日
In theory, you would do,
[c1,c2]=deal(coef);
c2(end)=c2(end)-15;
r1=roots(c1);
r2=roots(c2);
time=r2(r2>43 & r2<45) - r1(r1>37 &r1<39);
However, in practice, root finding operations for polynomials of super-high order are mumerically unstable, see

カテゴリ

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

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by