Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

finding local maxima

  • 15-06-2004 11:55AM
    #1
    Registered Users, Registered Users 2 Posts: 1,368 ✭✭✭


    Ok,

    I 've got an array holding integers describing a sin wave. The values range from about +30 to -30.

    The problem is, the signal can be noisy enuf, and peak detection (finding the indexes of local maxima within the signal) can be quite difficult.

    I have two algorithms myself (which arent quite good enuf), but I'd be interested if anyone had any other ideas on how to tackle the problem....

    Thanks,

    King


Comments

  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 96,350 Mod ✭✭✭✭Capt'n Midnight


    you're looking at some sort of moving average,
    using trapeziod or simpsons(SP)
    the number of points to be averaged depends on the noise.


  • Closed Accounts Posts: 47 PhilH


    I may be reading too much into the question, but it sounds more like a curve fitting problem. If you know it is a sin wave, and you know the amplitude (+/-30) then surely all you need to know is the wavelength and the offset from zero (if any).


  • Registered Users, Registered Users 2 Posts: 1,372 ✭✭✭silverside


    If you just want to find the frequency of the signal, use spectral analysis (using FFT) to find the peak frequency.

    If its a strong signal, doing some sort of a linear filter such as a moving average should get you a good idea of the true signal.

    Is the noise random or does it have a pattern, possibly related to the signal? If so you might want to look at Kalman filtering.

    Could you post some sample data? How maths-y are you?


  • Registered Users, Registered Users 2 Posts: 1,368 ✭✭✭king_of_inismac


    Thanks for the replies guys,

    Used an averaging algorithm, and then a DSP algorithm to clean the signal.

    Then I cut off the top off the wave and found the centre point of the arc. This represented the peak position.

    Twas one hell of an algorithm, but it worked :D

    Thanks again,
    King


Advertisement