Filter löschen
Filter löschen

Aligning peaks from multiple shifted data sets

21 Ansichten (letzte 30 Tage)
Thomas
Thomas am 16 Okt. 2012
Bearbeitet: Sotiris Katsikis am 9 Jan. 2018
New to Matlab here, but impressed at the speed with which I've been able to accomplish some fairly complex tasks already. Here's one that's got me scratching my head:
I have a lot of data sets (I call them spectra) that each contain two or more noisy peaks. I've included two such spectra in the figure below (I've differentiated between the spectra here by assigning them different colors). The two peaks visible in each spectrum are shifted along the x-axis with respect to the other spectrum due to instrumental drift. I need to:
  • correct for the shift along x so that both of the peaks in all of the spectra are aligned. The shift must be discrete (i.e. no interpolation along x);
  • match the spectra variables for length, sum them, and plot them;
  • automate the procedure for lots and lots of spectra. It also needs to accommodate the fairly noisy peaks (see figure).
Right now, I'm struggling to come up with the most effective way of telling Matlab how to do this. Taking the derivative of the spectra to locate the peak max is not very robust because many of my spectra don't have very nice, well defined maxima. Fitting them with Gaussians is also challenging because each peak is actually the sum of 3 - 4 separate Gaussian distributions, begging the question of which one to use for the alignment. Yet, the algorithm of my brain (comparing their shapes) has no trouble aligning them, so there must be a suitable routine in Matlab for it.

Antworten (2)

Doug Hull
Doug Hull am 16 Okt. 2012
I would start with something like this:
I think this is the most challenging part of the problem, the rest can you do if you knew the peaks?

Star Strider
Star Strider am 16 Okt. 2012
Bearbeitet: Star Strider am 16 Okt. 2012
I suggest you investigate detrend, and if you have the Signal Processing Toolbox, findpeaks. The nice thing about findpeaks is that you can use the options it has to make it reasonably robust with respect to noise and other problems. If you don't have findpeaks, using max (with two outputs) after using detrend may work for you.
  1 Kommentar
Sotiris Katsikis
Sotiris Katsikis am 9 Jan. 2018
Bearbeitet: Sotiris Katsikis am 9 Jan. 2018
Although 5 years + passed since the question, there are some specialised algorithms/toolkits/routines already published for this purpose. For example icoshift.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by