Best way to detect steps and slopes in a signal
This problem is heavily related to the notion of piece-wise constant or piece-wise linear approximations. Either to fit the experimental curve at best, or to find the optimal parameters may requires some more details, like: do you know the number of parts? Any idea about the noise? Some literature to start with:


Best piecewise constant approximation of a function of single variable
Models and Algorithms for Optimal Piecewise-Linear Function Approximation
Fitting Piecewise Linear Continuous Functions