Finding the exact end of decay period
3 ビュー (過去 30 日間)
古いコメントを表示
Hello All, I have some data such as the file attached. I want to know how I can find the exact end of the decay period so that I can later fit a linear line to my data. In my example, I want to know how to find the 10th data point automatically so that I can fit a linear line to data points from 1 to 10 not the whole data points. Basically I want MATLAB to find the exact end of the decay period. Because after the 10th point there is essentially no decay. Thanks everyone in advance.
0 件のコメント
採用された回答
Star Strider
2017 年 5 月 28 日
One option is to use the diff function on the y values, then define the end as the first occurrence of a positive value. The problem with diff is that the output is one element shorter than the input.
You can do a similar approach with the gradient function. The advantage of using gradient is that the length of the output vector is the same as the input vector, making addressing easier. So, the first positive value of the derivative is the end of the data you want to use.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!