Hi, I need to implement a software peak detector in either C, C++, C#.Net, Visual Basic.Net (as these are the languages i know). It is not just a simple sine/cosine input signal but more of a series of impulses, please see picture: - http://www.andy166.pwp.blueyonder.co.uk/Peaks.jpg The arrow indicates the peak i need to measure and the mess as the bottom is meant to be some smaller peaks with different frequencies. What is the best way to do this? other than an FFT if there is a better way can anybody point me in the direction of some examples/tutorials? Thanks, Xposiv166
Software Peak Detector
Started by ●November 9, 2009
Reply by ●November 9, 20092009-11-09
Xplosiv166 wrote:> Hi, > > I need to implement a software peak detector in either C, C++, C#.Net, > Visual Basic.Net (as these are the languages i know). > > It is not just a simple sine/cosine input signal but more of a series of > impulses, please see picture: - > > http://www.andy166.pwp.blueyonder.co.uk/Peaks.jpg > > The arrow indicates the peak i need to measure and the mess as the bottom > is meant to be some smaller peaks with different frequencies. > > What is the best way to do this? other than an FFT if there is a better > way can anybody point me in the direction of some examples/tutorials?I probably don't understand what you want. It would seem that your question is about the time signal, but an FFT is for frequency analysis. Assuming that the reference to FFT is a red herring, the sample rate would need to be known. Sharp peaks indicate high frequencies. To derive the peak from a sample set, there needs to be a sample near the peak. This isn't hopeless, but it's not simple. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●November 9, 20092009-11-09
Xplosiv166 wrote:> Hi, > > I need to implement a software peak detector in either C, C++, C#.Net, > Visual Basic.Net (as these are the languages i know). > > It is not just a simple sine/cosine input signal but more of a series of > impulses, please see picture: - > > http://www.andy166.pwp.blueyonder.co.uk/Peaks.jpg > > The arrow indicates the peak i need to measure and the mess as the bottom > is meant to be some smaller peaks with different frequencies.Define "measure". {That's much more thought provoking than it appears ;} Suggestion: Sketch the problem on grid paper. If you define "measure" in any of five ways that crossed my mind the answer to your question will be sitting there. That you mention using an fft suggests either: your sketch doesn't adequately portray the problem you are trying an excessively complicated approach> > What is the best way to do this? other than an FFT if there is a better > way can anybody point me in the direction of some examples/tutorials? > > Thanks, > > Xposiv166
Reply by ●November 9, 20092009-11-09
On Nov 10, 12:58�pm, "Xplosiv166" <andrew_...@blueyonder.co.uk> wrote:> Hi, > > I need to implement a software peak detector in either C, C++, C#.Net, > Visual Basic.Net (as these are the languages i know). > > It is not just a simple sine/cosine input signal but more of a series of > impulses, please see picture: - > > http://www.andy166.pwp.blueyonder.co.uk/Peaks.jpg > > The arrow indicates the peak i need to measure and the mess as the bottom > is meant to be some smaller peaks with different frequencies. > > What is the best way to do this? other than an FFT if there is a better > way can anybody point me in the direction of some examples/tutorials? > > Thanks, > > Xposiv166Well, if you can't figure out that then there's something wrong with your knob. Hardy
Reply by ●November 9, 20092009-11-09
On Mon, 09 Nov 2009 17:58:58 -0600, Xplosiv166 wrote:> Hi, > > I need to implement a software peak detector in either C, C++, C#.Net, > Visual Basic.Net (as these are the languages i know). > > It is not just a simple sine/cosine input signal but more of a series of > impulses, please see picture: - > > http://www.andy166.pwp.blueyonder.co.uk/Peaks.jpg > > The arrow indicates the peak i need to measure and the mess as the > bottom is meant to be some smaller peaks with different frequencies. > > What is the best way to do this? other than an FFT if there is a better > way can anybody point me in the direction of some examples/tutorials?For the life of me I can't see how an FFT is going to measure a peak for you. If you need to filter _then_ measure, an FFT may help you with the filtering, but that's about it. Your question is vague. Good mathematical definitions of the peak that you want to automatically measure can be astonishingly hard to write in such a way that you don't end up automatically measuring noise -- expect to spend weeks with well-detected false peaks and missed real peaks, possibly both in the same data set. Tell us what you _really_ want, and perhaps someone can help. If you're really truly looking at a data set that looks like your sketch, then just take the maximum. -- www.wescottdesign.com
Reply by ●November 9, 20092009-11-09
On Nov 9, 6:58�pm, "Xplosiv166" <andrew_...@blueyonder.co.uk> wrote:> Hi, > > I need to implement a software peak detector in either C, C++, C#.Net, > Visual Basic.Net (as these are the languages i know). > > It is not just a simple sine/cosine input signal but more of a series of > impulses, please see picture: - > > http://www.andy166.pwp.blueyonder.co.uk/Peaks.jpg > > The arrow indicates the peak i need to measure and the mess as the bottom > is meant to be some smaller peaks with different frequencies. > > What is the best way to do this? other than an FFT if there is a better > way can anybody point me in the direction of some examples/tutorials? > > Thanks, > > Xposiv166Peak detector? Method 1: You sift through the samples and pick the highest value Method 2: You start the first sample, and compare to next sample. If next sample is hgher then you compare to that sample. Keep making comparisons until you have run through your time interval of interest. Method 3: Can't think of method 3.
Reply by ●November 9, 20092009-11-09
Tim Wescott wrote:> On Mon, 09 Nov 2009 17:58:58 -0600, Xplosiv166 wrote: > >> Hi, >> >> I need to implement a software peak detector in either C, C++, C#.Net, >> Visual Basic.Net (as these are the languages i know). >> >> It is not just a simple sine/cosine input signal but more of a series of >> impulses, please see picture: - >> >> http://www.andy166.pwp.blueyonder.co.uk/Peaks.jpg >> >> The arrow indicates the peak i need to measure and the mess as the >> bottom is meant to be some smaller peaks with different frequencies. >> >> What is the best way to do this? other than an FFT if there is a better >> way can anybody point me in the direction of some examples/tutorials? > > For the life of me I can't see how an FFT is going to measure a peak for > you. If you need to filter _then_ measure, an FFT may help you with the > filtering, but that's about it. > > Your question is vague. Good mathematical definitions of the peak that > you want to automatically measure can be astonishingly hard to write in > such a way that you don't end up automatically measuring noise -- expect > to spend weeks with well-detected false peaks and missed real peaks, > possibly both in the same data set. > > Tell us what you _really_ want, and perhaps someone can help. If you're > really truly looking at a data set that looks like your sketch, then just > take the maximum.Tim, do you have any reason to believe that there will be a sample near the peak? Do you suspect that the waveform might be repetitive? Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply by ●November 9, 20092009-11-09
On Nov 9, 6:58�pm, "Xplosiv166" <andrew_...@blueyonder.co.uk> wrote:> Hi, > > I need to implement a software peak detector in either C, C++, C#.Net, > Visual Basic.Net (as these are the languages i know). > > It is not just a simple sine/cosine input signal but more of a series of > impulses, please see picture: - > > http://www.andy166.pwp.blueyonder.co.uk/Peaks.jpg > > The arrow indicates the peak i need to measure and the mess as the bottom > is meant to be some smaller peaks with different frequencies. > > What is the best way to do this? other than an FFT if there is a better > way can anybody point me in the direction of some examples/tutorials? > > Thanks, > > Xposiv166There is no general-purpose solution to your problem. Just come up with something on your own. John
Reply by ●November 9, 20092009-11-09
John wrote:> On Nov 9, 6:58 pm, "Xplosiv166" <andrew_...@blueyonder.co.uk> wrote: > >>I need to implement a software peak detector in either C, C++, C#.Net, >>Visual Basic.Net (as these are the languages i know). >>What is the best way to do this?> There is no general-purpose solution to your problem. Just come up > with something on your own.There are two general purpose solutions: do it yourself or hire someone who knows. VLV
Reply by ●November 10, 20092009-11-10
At 10-11-2009 on 00:58:58 Xplosiv166 <andrew_166@blueyonder.co.uk> wrote: (...)> http://www.andy166.pwp.blueyonder.co.uk/Peaks.jpgYour signal backs in time. -- Mikolaj






