I want to find inflections point for point data input?

21 ビュー (過去 30 日間)
Vishal Rajpurohit
Vishal Rajpurohit 2018 年 6 月 15 日
コメント済み: Vishal Rajpurohit 2018 年 6 月 18 日
i have input points
x=[0 1 2 3 4 5 6 7 8 9 10]
y=[5.0000 6.0000 8.0000 9.0000 8.5000 8.0000 7.0000 6.5000 7.0000 8.0000 10.0000]
x1=0:0.001:10;
y1=interp1(x,y,x1,'spline');
plot(x1,y1);
i want to find inflection points on that curve?
explain with full code please.

採用された回答

Guillaume
Guillaume 2018 年 6 月 15 日
The inflections points are when the sign of the difference of your y changes. So, whichever way you obtain your y points (as is or using linear or spline interpolation), the indices of the inflection points are:
inflection_idx = find(diff(sign(diff(y)))) + 1; %+1 to compensate for the index shift caused by the double diff
Note that linear interpolation won't change the location of the inflection points, it'll still be at y=9 and y=6.5, and even with spline interpolation it's not going to change much.
  7 件のコメント
Guillaume
Guillaume 2018 年 6 月 18 日
Yes, not sure what I was thinking, it's the 2nd derivative, so a double diff:
inflection_idx = find(diff(sign(diff(diff(y1))))) + 1;
It may be more accurate to use gradient instead of diff to calculate the 2nd derivate:
inflection_idx = find(diff(sign(gradient(gradient(y1)))));
Vishal Rajpurohit
Vishal Rajpurohit 2018 年 6 月 18 日
thank you sir,

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

その他の回答 (0 件)

カテゴリ

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