Matlab: Separate data samples from signal
This is a little hacky, but it uses the three models you have to find an "eigen"-pulse and then takes successive inner products of a normalized signal segment with this "eigen"-pulse to give a measure between -1.0 and 1.0.

The red line in the image is your data.  The black line is this normalized measure.  You'll have to sanity check it (no detections within 2 samples of a previous detection ?), but other than that selecting anything above 0.8 should let you detect the start of the pulses.





R Code Below

  #31201

  arm &lt;- c(12,-23,1,-2,-40,-45,80,85,14,-28,10,-22,-100,-105,80,85,14,-2, 16,-2,-200,-45,305,85,1,-2,1,-2)

  #1 [-40,-45,80,85]
  #2 [-100,-105,80,85]
  #3 [-200,-45,305,85]
  rep1 &lt;- c(-40,-45,80,85)
  rep2 &lt;- c(-100,-105,80,85)
  rep3 &lt;- c(-200,-45,305,85)

  repMat &lt;- rep1 %*% t(rep1) + rep2 %*% t(rep2) + rep3 %*% t(rep3);
  mean1 &lt;- (rep1+rep2+rep2)/3

  eigs &lt;- eigen(repMat)

  plot(rep1, ylim=c(-350, 350), col="red", lwd=6, type="l")
  lines(rep2, col="green", lwd=4)
  lines(rep3, col="blue", lwd=2)
  lines(mean1)
  lines(eigs$vectors[,1]*sqrt(eigs$values[1]), col="purple", lwd=1)

  eigs$vectors[,1] %*% rep1

  similarity &lt;- rep(0,length(arm))
  for (idx in seq(1,length(arm)-3))
  {
    patch &lt;- arm[idx + seq(0,3)]
    patch &lt;- patch / sqrt(sum(patch ^ 2))
    similarity[idx] &lt;- (eigs$vectors[,1] %*% patch)
  }

  plot(similarity, type="l")
  lines(arm/max(arm), col="red")