How to detect if a signal raises sharply or slowly?

so how can i detect if a signal raises sharply or not ? Are there easy solutions (i suppose there are) ?

the problem is that if a signal raises sharply, i need less data to not pollute the dataset and if the signal raises slowly then i need more data. But how to determine the number of data, without knowing if it's sharp or not?

Also I need to know if it raises sharply when i'm at the top of the curve, NOT afterwards (in realtime if you want)

thanks so much

Jeff

• I think you should add more information about the type of signal and what exactly is sharp and what not (what is the threshold between these states?). Some examples would be helpful too. – Irreducible May 15 '19 at 13:40
• thank you for that answer. here is an example of a sharp signal, and here is an example of a slow signal (to filter). I was thinking maybe just look at the max slope of the past few bars ? (then the number of past bars doens't matter so much, i can look from a zero cross). khaelis.com/downloads/screenshotSharp.jpg and khaelis.com/downloads/screenshotSlow.jpg (positiveness doesn't matter , sorry it's reversed) – Jeff May 15 '19 at 14:14
• Edit your question and add these examples. Additionally it sustains unclear what the boarder between slow and sharp is? – Irreducible May 15 '19 at 14:28
• yes that's exactly my point. that's why i'm asking the questions. Maybe calculate the standart deviation bewteen all the past slopes (fropm a zero crossing?). a high standart deviation would means the difference between the slopes angle is high (what occurs in sharp signals) whereas if the STD DEV is low it means all the slopes are kinda the same. What do you think? That plus using the max slope – Jeff May 15 '19 at 14:31
• It is difficult to help you, as no one besides you has experience with the data. How comparable or equal are all slow and sharpe slopes in general. We have no idea about the variability of your data. This information is missing – Irreducible May 15 '19 at 14:34

I believe that you can calculate the derivate which is the rate of signal change. In discrete signals this is obtained (approximated) by:

$$x'[k] = x[k]-x[k-1]$$

(by other words, it's the difference between consecutive samples)

• Yes, and thank you for your answer. But with the derivative (the slope) how can i differenciate between a sharp signal and a slow signal ? my idea would be to compare the max slope between signals, but this is looking at only ONE information, i think there would be a better way to determine the sharpness (if it rises fast or slow) thanks – Jeff May 15 '19 at 14:28
• If you integrate (sum up) the derivatives $x'[k]$ as described in the answer, you get a single figure that describes how strong the overall fluctuation is. – applesoup May 15 '19 at 15:29
• @Jeff you can define a threshold value for the derivative. Anything above this will be a sharp signal and below will be a slow signal. – Filipe Pinto May 16 '19 at 0:17
• hmm i think i will use weights in my calculation, because last values are more imporant than old values, right? so my idea is to make a weighted mean of the derivatives. I'm not sure how many bars ago i have to select : My idea would be to select the same "area" : meaning if there is a sharp tall signal, the area would be bigger so there would need less bars, but if the signal is low, then the area is smaller so i need more bars. What do you think? – Jeff May 16 '19 at 9:24
• The number of samples to consider depends on you sampling frequency and on what you consider to be a fast and a slow signal. – Filipe Pinto May 17 '19 at 11:19