You are not logged in.

- Topics: Active | Unanswered

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

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

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,380

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.****If it ain't broke, fix it until it is.**

Offline

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

Then Is there any way to find peaks and valley s?

Please guide me in this regard .

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,380

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.****If it ain't broke, fix it until it is.**

Offline

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

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 ?

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,380

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.****If it ain't broke, fix it until it is.**

Offline

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

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 ?

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,380

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.****If it ain't broke, fix it until it is.**

Offline

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

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 ?

Offline

**anonimnystefy****Real Member**- From: Harlan's World
- Registered: 2011-05-23
- Posts: 16,015

Hi tina123

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

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,380

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.****If it ain't broke, fix it until it is.**

Offline

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

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

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,380

Hi;

Want to see another example?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

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 .

Offline

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

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

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,380

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.****If it ain't broke, fix it until it is.**

Offline

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

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

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,380

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.****If it ain't broke, fix it until it is.**

Offline

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

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 .

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,380

I can not see bins it it too small.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

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 .

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,380

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.****If it ain't broke, fix it until it is.**

Offline

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

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 .

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,380

Do you see what a peak is?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

**tina123****Member**- Registered: 2012-04-29
- Posts: 83

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

Offline