Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

## #1 2012-09-21 21:54:51

tina123
Full Member

Offline

### detect peaks and valleys

I have histogram shown in this figure :  http://i1069.photobucket.com/albums/u472/tina12354/h1_zps40094c32.png

The problem is i need to detect peaks and valleys .
i tested 1st derivative . and where if difference tend to 0. there is a valley .
but for example if upper slope have value 26 , 26 . then it will also tend to 0. which will hard to tell that its valley or peak.

Any idea to  get peak and valleys .
thanks

## #2 2012-09-21 22:11:25

bobbym

Online

### Re: detect peaks and valleys

Hi tina123;

That histogram is for discrete values. Using derivatives is for continuous data. You generally can not find peaks and valleys of discrete dat using derivatives.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #3 2012-09-21 22:14:37

tina123
Full Member

Offline

### Re: detect peaks and valleys

Then Is there any way to find peaks and valley s?
Please guide me in this regard .

## #4 2012-09-21 22:18:44

bobbym

Online

### Re: detect peaks and valleys

You could search through the discrete data for maximum values and minimum values.

Below is a histogram for this data

You can get the peak by just counting how many of each type of numbers there are. There are 4 ones, this is the most.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #5 2012-09-22 23:06:59

tina123
Full Member

Offline

### Re: detect peaks and valleys

so you meant the minimum value would be our valley . is it ?
In your data set ..  1 is the most minimum value .
so it  would be a valley .  Is it ?

## #6 2012-09-22 23:08:19

bobbym

Online

### Re: detect peaks and valleys

A histogram charts occurences. One has 4 occurences as you see in the histogram. It is a peak not a valley.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #7 2012-09-22 23:09:46

tina123
Full Member

Offline

### Re: detect peaks and valleys

#### bobbym wrote:

A histogram charts occurences. One has 4 occurences as you see in the histogram. It is a peak not a valley.

ok and now about the valley ?

## #8 2012-09-22 23:13:50

bobbym

Online

### Re: detect peaks and valleys

Hi;

Look at the histogram. 2 is a valley because there is only one of them. 3 is a valley because there is only one of them. 7 i s a valley. Can you find more.

This is only way one of looking at this data if I understand you correctly.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #9 2012-09-22 23:14:15

tina123
Full Member

Offline

### Re: detect peaks and valleys

So i think  check occurrence  of each data ..  valley will be there where occurrence would be minimum,
and maximum occurrence would be peak .
but for  example if 1 is repeated 4 time 10 is repeated 3  . then we would have two  peaks at 1 having 4 occurence and 10 having 3 occurrence . and say 5 have occurrence 2 .. so minimum occurence would be our valley .
right  ?

## #10 2012-09-22 23:18:04

anonimnystefy
Real Member

Offline

### Re: detect peaks and valleys

Hi tina123

What exactly would you consider peaks and valleys in the picture in your first post?

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

## #11 2012-09-22 23:21:36

bobbym

Online

### Re: detect peaks and valleys

Hi tina123;

Yes, minimum occurence would be a valley. There could be more than one.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #12 2012-09-22 23:30:22

tina123
Full Member

Offline

### Re: detect peaks and valleys

#### anonimnystefy wrote:

Hi tina123

What exactly would you consider peaks and valleys in the picture in your first post?

Well if we consider only useful data . then its from i = 0 ; i < 46 ; i++ , get minimum value. it would be 2 . which will be our valley .  but for and 21 will be our maxmum peak .

that 's by considering minimum and maximum histogram value .

But i still not understand correctly

## #13 2012-09-22 23:31:18

bobbym

Online

### Re: detect peaks and valleys

Hi;

Want to see another example?

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #14 2012-09-22 23:34:39

tina123
Full Member

Offline

### Re: detect peaks and valleys

#### bobbym wrote:

Hi tina123;

Yes, minimum occurence would be a valley. There could be more than one.

Hy Bobvym , I am confused . Could u tell me peaks and valleys in the same theory that u recently explained .
thanks .

## #15 2012-09-22 23:36:33

tina123
Full Member

Offline

### Re: detect peaks and valleys

#### bobbym wrote:

Hi;

Want to see another example?

Well  i understand with an example that recently u mentioned .
but i did not  get valley and peak in my #1 post .
Could you please make my mind clear from histogram of post #1 .
thanks

## #16 2012-09-22 23:42:23

bobbym

Online

### Re: detect peaks and valleys

Here is a histogram like yours, it contains values from 0 to 46.

Can you find the valley?

Could you please make my mind clear from histogram of post #1 .
thanks

That I cannot do. That drawing is not labelled so how can tell what the peaks are? I can pick them out but I do not know what numbers they are. Also I do not have the data and I can not get from that picture.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #17 2012-09-22 23:58:27

tina123
Full Member

Offline

### Re: detect peaks and valleys

well in my #1 post ,
on axis .. we have index 0 to 53
and on y  axis ,. we have , 0 to 21 .

like on axis 0 will  have bar 19 length .. like that

## #18 2012-09-23 00:00:37

bobbym

Online

### Re: detect peaks and valleys

You say that on the x axis we go from 0 to 53. Does that mean the whole black area or just the red?

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #19 2012-09-23 00:03:11

tina123
Full Member

Offline

### Re: detect peaks and valleys

#### bobbym wrote:

You say that on the x axis we go from 0 to 53. Does that mean the whole black area or just the red?

Well  all bins are in red color .

## #20 2012-09-23 00:12:16

bobbym

Online

### Re: detect peaks and valleys

I can not see bins it it too small.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #21 2012-09-23 00:17:47

tina123
Full Member

Offline

### Re: detect peaks and valleys

#### bobbym wrote:

I can not see bins it it too small.

Well actually i maked histogram in range 0 to 180 . and to make histogram i consider bins 180 . so bins size is so small .
and after removing some noise and part of histogram .
i got the histogram that i posted in #p1 ..
so now our left bins are in range 0 to 53 .

## #22 2012-09-23 00:18:52

bobbym

Online

### Re: detect peaks and valleys

I have marked off two peaks, I can not see what number they are.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #23 2012-09-23 00:23:36

tina123
Full Member

Offline

### Re: detect peaks and valleys

#### bobbym wrote:

I have marked off two peaks, I can not see what number they are.

oh i gave histogram values too with its horizontal axis .

2nd peak value is 21 . and 1st peak value is 20 .

## #24 2012-09-23 00:33:17

bobbym

Online

### Re: detect peaks and valleys

Do you see what a peak is?

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #25 2012-09-23 00:37:55

tina123
Full Member

Offline

### Re: detect peaks and valleys

#### bobbym wrote:

Do you see what a peak is?

as i understand peak is maximum value ..  and 20 , 21 are the maximum . .

so those are peaks