I want to count steps which are basically represented by peaks in the signal. the red part in the signal doesnt correspond to any walking activity, I want to ignore them. Any help on segmenting or croping out the green parts of the signal.
Since I don't have access to your data, I found similar data online at https://archive.ics.uci.edu/ml/datasets/User+Identification+From+Walking+Activity#. It gives X-Y-Z accelerator readings. It is pretty clear that frequency content in the green and red sections are different. The green has significantly more high frequency components than the red. The frequency content changing over time had me think that short time Fourier analysis would be helpful.
So what I did was download the dataset and plot one of the signals to make sure we are looking at similar data. Here is a signal from the dataset I found online (pretty similar to yours!):
The next step would be to take a short time Fourier transform. MATLAB has already implemented this in the
stft function. Using the defaults and plotting the result, I get this:
Now you can see, over time, how the frequency content of the signal changes. Just as we suspected, most of the signal has more energy in the higher frequency, and there are two spots where the high frequency content vanishes. Essentially, the problem becomes detecting the dark blue vertical lines in the image, or equivalently detecting the higher frequency components. Hope this helps!