# Methods for edge detection with non-equidistant samples

This posting describes two methods of edge detection for wave analysis in a water pipe. I am not sure about advantaged and disadvantages. Therefore I want to evaluate the best method for this application. So please suggest new ones or judge the suggested.

Situation: There is a constant water flow through a pipe (horizontal - with constant diameter). Suddenly the pump stops and the resulting pressure drop travels along the pipe. There are several measurement points, which take a sample triggered by the sufficient value-change. Therefore the datapoints are not equally distributed in time.

Aim: I want to calculate the sound speed in the fluid from the velocity of this pressure wave. For this I need a method to detect the edges.

Approach 1: My first approach was to take the middle of this step which has a differential quotient above a certain treshold:

      if ( sign(treshold)*(y(count+1) - y(count))/(t(count+1) - t(count))   > sign(treshold)*treshold) then

tCutOff(j) =  0.5*(tCut1(count+1) + tCut1(count)); Approach 2: During some experiments, an advanced method came to my mind. It was motivated by the variation of the steepness in the first step of the edge. I alternatively tool the last few points before the detected step and some followers.

 precursor = [ t(count-5: count-1) ; y(count-5: count-1)]
follower  = [ t(count+1 : count+2); y(count+1: count+2)]


Then I build the regression with the line parameters a and b each. The cutoff point is defined as the crossing of both regression lines:

    tCutOff(j)  = -(follow_b - pre_b)/(follow_a - pre_a);


With the second approach I got the following results. • Did I choose the wrong forum? – peng Jan 3 '16 at 18:37
• I think about a now approach: 1) FIR LP filtering 2) numerical derivation 3) LP filtering of the derivative 4) find(max(abs(derivate))). Any hints? – peng Jan 20 '16 at 8:58