I am trying to compute the height of a peak detected using findpeaks function. The peak height should be computed relative to the previous amplitude before the peak (left side), as opposed to the prominence of the peak that computes the minimum vertical distance that the signal must descend on either side of the peak before either climbing back to a level higher than the peak or reaching an endpoint.
The left subplot is the result of the function findpeaks on the signal: The first peak prominence equals the wanted height, since it was computed realtive to the horizontal line (1). The second peak prominence does not equal the wanted height since it was computed realtive to the same horizontal line (1).
The right subplot is the result wanted: The second peak's height should be computed relative to the horizontal line (2).