필터 지우기
필터 지우기

Finding the exact end of decay period

조회 수: 3 (최근 30일)
masih
masih 2017년 5월 28일
댓글: Star Strider 2017년 5월 28일
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.

채택된 답변

Star Strider
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.
  댓글 수: 2
masih
masih 2017년 5월 28일
Thanks a lot
Star Strider
Star Strider 2017년 5월 28일
My pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by