Plot envelope of a grassy plot

Hi all, I have a graph which looks very grassy. What I want is the following (see picture). I have a grassy graphy (blue line), but I want the envelope which clearly shows the peaks of the graph (red line - this line is drawn in paint). A group of peaks may added to 1 group of peak. I have tried the following in matlab, without success: - smooth; - basic tool of curve fitting; - Hilbert transform; - polyfit; - Toolbox Ezyfit; butterworth function.
The problem is that I either get too many peaks, or the envelope does not really fit.
Any suggestions how to deal with this? Thanks in advance!

Respuestas (3)

Chad Greene
Chad Greene el 11 de Jun. de 2016

0 votos

Do you have the Signal Processing toolbox? If so, the envelope function makes is pretty easy to use.

1 comentario

André
André el 11 de Jun. de 2016
Thanks for your answer. I tried the envelope function, also with 'peak' to detect the peak envelope. However, it is still too grassy ..but it is sort of in the right direction ..

Iniciar sesión para comentar.

Image Analyst
Image Analyst el 11 de Jun. de 2016

0 votos

Another option is sgolayfilt(). They all give different looks and it just depends on what "look" you're looking for.
Image Analyst
Image Analyst el 11 de Jun. de 2016

0 votos

Maybe you can use findpeaks(). There are lots of options for specifying which peaks you want to detect and which you want to ignore. Then, once you've found the peaks, use linspace() to draw lines in between the peaks to fill out the array so that you have a value at every index.

6 comentarios

André
André el 12 de Jun. de 2016
I tried your suggestion, but I keep getting the following error:
Error using findpeaks
Expected X to be increasing valued.
However, there are many many X-values that are the same (and not increasing), and I do not want to delete it (manually), because I will probably lose too much information for my purpose.
Any idea how to proceed?
Image Analyst
Image Analyst el 12 de Jun. de 2016
Editada: Image Analyst el 13 de Jun. de 2016
We can't really help you unless you supply your X and x and y values and code.
André
André el 13 de Jun. de 2016
Please find attached. The first row is x and second row y.
Image Analyst
Image Analyst el 13 de Jun. de 2016
Please supply the code you used that generated the error and I'll try it tomorrow.
André
André el 13 de Jun. de 2016
I tried the following with findpeaks():
  1. findpeaks(y); because I want find the peaks of y and then proceed as you suggested
  2. findpeak(x,y); then I get the error message as above. In addition, I did not provide an X (only x and y as the file attached).
For point 1, I am able to detect the peaks, but there is a shifting in the x-axis and y-axis.
How to proceed from here?
André
André el 14 de Jun. de 2016
I also tried stem() instead of plot() and then envelope, but without success still.

Iniciar sesión para comentar.

Preguntada:

el 11 de Jun. de 2016

Comentada:

el 14 de Jun. de 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by