Like Tree2Likes
  • 2 Post By Salem

Finding the 50% values around a maximum

This is a discussion on Finding the 50% values around a maximum within the C++ Programming forums, part of the General Programming Boards category; Hi guys (sorry there is no subject title; couldn't really think of an accurate one), This is my situation: I ...

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    224

    Cool Finding the 50% values around a maximum

    Hi guys (sorry there is no subject title; couldn't really think of an accurate one),

    This is my situation:
    I have data which when I graph it gives me a peak. I want to find the resolution of my peak by finding the 50% point and dividing it by the width.
    Its hard to explain in words so I drew a picture... please see attached.

    Basically, I want to find the width @ 50% intensity of the peak.

    Any ideas how I can do this???

    Cheers :-)
    Attached Images Attached Images  

  2. #2
    Registered User
    Join Date
    Jul 2011
    Posts
    10
    A. Find the peak.
    B. find 1/2 the peak.

    Do you mean width as in how many numbers from 1/2 to 3/2 of peak, or do you mean width as in the distance from each number?

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    224
    Thanks for reply.

    Find the peak is OK.

    Find 50% is OK. But the problem is 50% of the maximum may not exist. Need to round to the nearest number. Any ideas on that???

    Also, other problem is that I need 2 values @ ~50% from each end of the peak. How do I ensure that I get from both ends of the peak???

    Once I have these values at 50% on both ends of the peak the rest seems pretty straigh forward for me to just read off the corresponding x values.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,489
    I fixed your title by the way.

    > But the problem is 50% of the maximum may not exist.
    But 50%+δ and 50%-δ will exist, so searching forwards/backwards for say while ( a[pos] > max/2 ) will find the 50% transition points.
    strokebow and King Mir like this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    839
    fyi: this is generally called, among other things, the full width at half maximum (FWHM).

  6. #6
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I find Chapter..1...Boost.Accumulators very useful for this kind of stuff. Not sure if it contains a solution for your exact problem.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #7
    Registered User
    Join Date
    Apr 2006
    Posts
    2,023
    You will also want to decide how you want to handle noisy data, where the data is not steadily rising or falling, but instead dips down a bit near the 50% level.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  8. #8
    3735928559
    Join Date
    Mar 2008
    Location
    RTP
    Posts
    839
    let's hope they wouldn't saddle him with a filtering/least squares problem at this stage of the game; that would be a little brutal for a noob.

  9. #9
    Registered User
    Join Date
    Apr 2006
    Posts
    2,023
    It should still be a consideration though, even if you're not willing to apply smoothing. Do you work from the middle to find the first number that dips bellow 50%, or from the edges to find the first number above 50%? The results will be different for certain datasets.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. finding mean minimum and maximum values
    By begginer in forum C Programming
    Replies: 1
    Last Post: 03-25-2011, 11:55 PM
  2. finding the second maximum.
    By lbillys in forum C Programming
    Replies: 6
    Last Post: 05-18-2009, 08:23 PM
  3. Finding the maximum in an array
    By Turtal in forum C Programming
    Replies: 4
    Last Post: 11-15-2006, 06:07 AM
  4. Finding maximum queue length
    By crepincdotcom in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-05-2004, 09:31 AM
  5. finding maximum munber
    By condorx in forum C Programming
    Replies: 5
    Last Post: 03-25-2002, 11:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21