Finding the exact end of decay period

5 visualizaciones (últimos 30 días)
masih
masih el 28 de Mayo de 2017
Comentada: Star Strider el 28 de Mayo de 2017
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.

Respuesta aceptada

Star Strider
Star Strider el 28 de Mayo de 2017
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 comentarios
masih
masih el 28 de Mayo de 2017
Thanks a lot
Star Strider
Star Strider el 28 de Mayo de 2017
My pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Particle & Nuclear Physics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by