-2

I am writing code that takes a signal from an accelerometer and I use the TVD algorithm in order to denoise the signal. As we can see in the following graph I managed to do that:

Denoising

But I want to detect the peaks, and I think that I could use the findchangepts function in MATLAB, but when I run it I have the following:

findchangepts function run

As we can see it not detects the peaks. Does anyone know any setting in the function, or a way to denoise inside the peak?

Wolfie
  • 27,562
  • 7
  • 28
  • 55
  • From the [docs](https://uk.mathworks.com/help/signal/ref/findchangepts.html): "`findchangepts(x)` returns the **index** at which the mean of x changes most significantly.` Specify more than one point using `findchangepts(x,'MaxNumChanges',5)`. Or use `findpeaks`. Always do a simple documentation search before asking here... – Wolfie Sep 15 '17 at 07:36
  • Thanks @Wolfie i had done that search also but the problem with that is that I am not able to now the exact number of changes as the code will be used for multiple signals, and multiple changes in the signals, which may differ one from another. Also when I use the findpeaks function, it gives me all the peaks, which in the signal you can see in the photo are, althought it does not seem to, 5402 peaks, that was why I asked for a better filtering. – Miguel Sanz Narrillos Sep 15 '17 at 07:42

1 Answers1

0

I manage to do that with the findpeaks function as follows:

[pks, locs] = findpeaks(x,'MinPeakProminence',0.25*max(x),'MinPeakDistance',50);

and having x passing throght a series of envelope filters and low pass filters as:

[yupper,ylower] = envelope(x)

Hope it will be usseful for someone

  • I don't think this *will* be very useful for anyone, it's a very broad answer ("here's how I found was good to filter my specific data the way I wanted") to a very broad question ("I want to filter this data in some way, this thing I tried didn't work, here's an image with no example data"). You could try and improve the question to make it clearer what you want to achieve, why, how, example data, code you've tried... – Wolfie Sep 15 '17 at 07:58