Matlab: Detect Peaks and Signal Jump I want to detect 6 peaks in a signal. I am open to any suggestions. There is one problem where my signal sometimes jumps high and stays higher than the rest of the signal. I don't know why this happens but would like a solution to lower the signal back to the points where the rest of the signal was lower, which might help detect all 6 peaks. I attached a picture.
I think the easiest option is to detect the massive sudden increase/decrease.
Try calculating the difference between samples. If this difference is too big (positive or negative), we substract this difference on all future measured samples.

Create a variable for this offset. start with an offset of 0, when de absolute value of the difference between samples is too big, add this (non absolute) difference to the offset, then all next samples are $x_{new}=x-offset$.