Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me detect peaks and locations of them

Status
Not open for further replies.

Supaswing

Junior Member level 3
Joined
Jul 14, 2005
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,601
Imagine you have a signal like in the attachement (sorry, made with paint), noisy with not regular peaks and peak height at different levels. What you need is counting the peaks without missing them.
I most simple I thought was a low pass (smoothing) + discrimation (difference) + threshold + minima, but I am not satisfied with this.
What would do in that case?

Thank you
 

peaks detection

you need to do smothing .
then you need to take the difference of signal from its previous value after certain times.
When the difference goes from positive to negative you have found a peak.
 

Re: peaks detection

What if you pass this signal through a capacitor to remove dc and just count zero-crossings?

Regards,
IanP
 

Re: peaks detection

Like IanP suggested, you can couple with a cap and connect to a hi speed comparator with hysteresis then to a counter to count the peaks.
 

peaks detection

I suppose that some heurisitcs do apply for the case.

You can use floating threshold for matching as :
- smooth data with LPF (if digitally - choose some window to multiply)
- implement low and high peak detection by continuosly calculating derivative of smoothed data (positive to negative - high peak,
negative to positive - low peak). Update lowest peak for every case when it is observed.
- When high peak is detected compare it to the latest low peak observed plus constant threshold value .

Low pass filter frequency is dependent on shortest possible peak width or duration

Eliminating of DC part could lead to case some peaks will not pass zero and will be missed from recording .
 

Re: peaks detection

Thank you for your advices, the becuase trouble comes from the threshold or the hystersis setting, which I want to be autoadjusted, and actually there is a lot of divergence from sample to sample and some min are higher than other max even after high passing.
And furthermore I would like to determine the location of the peaks.
Any idea?
Thank you very much
 

peaks detection

I already suggested floating threshold . Look to pseudocode for explanation
Code:
input signal f(t)
smoothed signal lp(t) (filtered windowed)
get_sample() - returns lp(t)
report_peak() - it is called upon peak detection

sign = 0;			// sign of derivation lp(t) - lp(t-1)
prev = 0;			// lp(t-1)
current = 0;			// lp(t)
CONST;				// constant value to be added to floating threshold base
bottom;				// floating threshold base


prev = get_sample();
current = get_sample();
sign = current >= prev? 1: -1;

if(sign == 1)
	bottom = prev;

for(;;)
{
	prev = current;
	current = get_sample();
	if(sign == -1)
	{
		if(current >= prev)
		{
			sign = 1;
			bottom = prev;
		}
	}
	else
	{
		if(current < prev)
		{
			sign = -1;
			if((bottom + CONST) < prev)
				report_peak();
		}
	}
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top