Click here to Skip to main content
15,901,426 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Real time peak identification Pin
Luc Pattyn26-May-11 9:09
sitebuilderLuc Pattyn26-May-11 9:09 
GeneralRe: Real time peak identification Pin
Wjousts26-May-11 9:20
Wjousts26-May-11 9:20 
AnswerRe: Real time peak identification Pin
Luc Pattyn26-May-11 9:44
sitebuilderLuc Pattyn26-May-11 9:44 
AnswerRe: Real time peak identification Pin
Peter_in_278025-May-11 13:38
professionalPeter_in_278025-May-11 13:38 
AnswerRe: Real time peak identification Pin
Luc Pattyn25-May-11 14:52
sitebuilderLuc Pattyn25-May-11 14:52 
GeneralRe: Real time peak identification Pin
Peter_in_278025-May-11 16:14
professionalPeter_in_278025-May-11 16:14 
GeneralRe: Real time peak identification Pin
Wjousts26-May-11 9:10
Wjousts26-May-11 9:10 
AnswerRe: Real time peak identification [modified] Pin
Peter_in_278029-May-11 14:17
professionalPeter_in_278029-May-11 14:17 
re: Your baseline drift problem.
That's what I was referring to when I mentioned adaptive threshold. There are two simple ideas that spring to mind.
(If this reads like 'thinking aloud', it's meant to. Showing the thought process.)
1. Keep a moving average, which should be a reasonable measure of the current baseline
moving_average = weight * this_sample + (1.0 - weight) * moving_average

The value of weight adjusts the 'time constant' of the averaging, in units of the sample interval. In your case, a value in the range 0.01 to 0.1 is probably a good starting point. Then your threshold is moving_average + (an educated guess of say 75% of a typical peak)
2. This last bit looks messy, so why not run a moving peak detector ('leaky' peak detector) as well as a moving average as above, then you could get a good estimate of the current behaviour of your input signal. Both the moving average and leaky peak are very cheap to implement (in terms of processing effort).
Leaky peak:
if (this_sample > running_peak)
    running_peak = this_sample;
else
    running_peak = alpha * moving_average + (1.0 - alpha) * running_peak;

alpha probably about half of weight from above.
Do all this after smoothing, of course. Otherwise your noise will stuff up the running peak.

Cheers,
Peter

[edit] Fixed up leaky peak stuff. [/edit]
Software rusts. Simon Stephenson, ca 1994.
modified on Monday, May 30, 2011 7:11 PM

GeneralRe: Real time peak identification Pin
Wjousts31-May-11 3:55
Wjousts31-May-11 3:55 
AnswerRe: Real time peak identification Pin
InfRes31-May-11 21:31
InfRes31-May-11 21:31 
GeneralRe: Real time peak identification Pin
Wjousts1-Jun-11 8:15
Wjousts1-Jun-11 8:15 
AnswerRe: Real time peak identification Pin
YDaoust31-May-11 21:47
YDaoust31-May-11 21:47 
GeneralRe: Real time peak identification Pin
Wjousts1-Jun-11 8:17
Wjousts1-Jun-11 8:17 
GeneralRe: Real time peak identification Pin
YDaoust1-Jun-11 8:47
YDaoust1-Jun-11 8:47 
AnswerRe: Real time peak identification Pin
peterchen31-May-11 22:11
peterchen31-May-11 22:11 
GeneralRe: Real time peak identification Pin
Wjousts1-Jun-11 8:22
Wjousts1-Jun-11 8:22 
AnswerRe: Real time peak identification Pin
MartinW13071-Jun-11 0:22
MartinW13071-Jun-11 0:22 
AnswerRe: Real time peak identification Pin
Skymir1-Jun-11 2:59
Skymir1-Jun-11 2:59 
AnswerRe: Real time peak identification [modified] Pin
Antonino Porcino1-Jun-11 5:56
Antonino Porcino1-Jun-11 5:56 
AnswerRe: Real time peak identification Pin
DMJ0011-Jun-11 10:12
DMJ0011-Jun-11 10:12 
GeneralRe: Real time peak identification Pin
largenqcd1-Jun-11 17:33
largenqcd1-Jun-11 17:33 
QuestionBest fit polynomial curve to non-continuous data points [Solved] Pin
Ian Shlasko23-May-11 4:43
Ian Shlasko23-May-11 4:43 
AnswerRe: Best fit polynomial curve to non-continuous data points Pin
_Erik_23-May-11 5:07
_Erik_23-May-11 5:07 
GeneralRe: Best fit polynomial curve to non-continuous data points Pin
Ian Shlasko23-May-11 5:20
Ian Shlasko23-May-11 5:20 
GeneralRe: Best fit polynomial curve to non-continuous data points Pin
_Erik_23-May-11 5:25
_Erik_23-May-11 5:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.