gradient(x) is basically doing diff(x). However, you could use da = gradient(a, diff(x)) to get the slope. See the docs on gradient<http://docs.julialang.org/en/latest/stdlib/base/#Base.gradient> .
// T On Tuesday, May 27, 2014 6:54:08 PM UTC+2, paul analyst wrote: > > Big thx, it is good way, > Intresting is also this > > dagr = diff(a) ./ diff(gradient(x)) > > and another offset avg ... > > Paul > > W dniu wtorek, 27 maja 2014 17:37:41 UTC+2 użytkownik Tomas Lycken napisał: >> >> If you have the y-values in a sorted vector, and the x-values in another >> sorted vector (or if they're just the index you don't need them), you can >> get the discrete derivative by using diff: >> >> da = diff(a) ./ diff(x) >> >> Now, the tangential tilt is less than 45 degrees whenever that derivative >> is larger than -1, so >> >> a[da .< -1] >> >> will give you the portion of a for which the slope is steeper than 45 >> degrees. (I might be off by one here, so you might want to experiment a >> little and see if you need to include one more, or one less, data point to >> get exactly what you want...) >> >> // T >> >> On Tuesday, May 27, 2014 4:53:52 PM UTC+2, paul analyst wrote: >>> >>> Thanks for the cool link. >>> Generally this is the point where the tangential tilt is 45 degrees. >>> Paul >>> >>> W dniu wtorek, 27 maja 2014 15:06:25 UTC+2 użytkownik Harlan Harris >>> napisał: >>>> >>>> Paul, I don't believe that this is a well-posed question. Determining >>>> what is the tail of a distribution and what isn't is very much >>>> problem-dependent. "getting flat" depends entirely on the scale of your >>>> data, and isn't meaningful. You could do what people constructing boxplots >>>> do, and use some multiple of the inter-quartile range from the median, but >>>> that still depends on the source, distribution, and meaning of your data. >>>> In any case, you'd be better off asking this somewhere like CrossValidated >>>> ( >>>> http://stats.stackexchange.com/) -- this isn't a Julia question. >>>> >>>> >>>> On Tue, May 27, 2014 at 8:22 AM, paul analyst <[email protected]>wrote: >>>> >>>>> Does not work always, distributions are different. >>>>> How to find the number of elements of the vector from which the chart is >>>>> getting flat (where is the beginning of the tail?) >>>>> Paul >>>>> >>>>> >>>>> W dniu wtorek, 27 maja 2014 12:19:09 UTC+2 użytkownik Yuuki Soho >>>>> napisał: >>>>> >>>>>> The simplest way to do it is probably to use a quantile: >>>>>> >>>>>> >>>>>> a=[5 3 2 1.5 1.1 1 0.8 0.25 0.2 0.16] >>>>>> >>>>>> q = quantile(vec(a),0.1) >>>>>> >>>>>> a = a[1:cut] >>>>>> >>>>>> >>>>>> >>>>
