Click here to Skip to main content
15,886,664 members
Home / Discussions / C#
   

C#

 
AnswerRe: Peak Search Algorithm with sliding window and peak excursion Pin
Krellon31-Jan-18 23:17
Krellon31-Jan-18 23:17 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Eddy Vluggen31-Jan-18 23:26
professionalEddy Vluggen31-Jan-18 23:26 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Krellon1-Feb-18 0:20
Krellon1-Feb-18 0:20 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Eddy Vluggen1-Feb-18 1:37
professionalEddy Vluggen1-Feb-18 1:37 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Krellon1-Feb-18 2:47
Krellon1-Feb-18 2:47 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Eddy Vluggen1-Feb-18 3:21
professionalEddy Vluggen1-Feb-18 3:21 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Krellon1-Feb-18 4:07
Krellon1-Feb-18 4:07 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Eddy Vluggen1-Feb-18 9:25
professionalEddy Vluggen1-Feb-18 9:25 
Krellon wrote:

If I could embed an image into my comment I would show you.
A good thing you can't; I asked not only because I'm bad at math, but also because I'm a bit simple. The PC is too, so once you can describe your problems in those kind of steps it becomes easy to translate it to code.

So I opened Calc, generated a chart, and.. you're looking for those three tops?

Krellon wrote:

Your essentially looping through an array of points looking for the biggest and smallest peaks and waiting for the delta either side them to go >= 6dB. When it does you grab the biggest peak between the -6dB points. Rinse and repeat.
That sounds like pseudo-code, so let me pseudo away (without compiler)

C#
double lastValue = 44;
List<double> peaks = new List<double>();
for (int i = 0; i < trace.Length; i++)
{
  double currentValue = trace[i];

  // waiting for the delta (so, diff between this and last value?)
  double delta = currentValue - lastValue;

  // either side them to go >= 6dB. (both sides = do for + and -)
  if (Math.Abs(delta) > 6)
  {
    // When it does you grab the biggest peak between the -6dB points. 
    DoMagic();
  }

  // now the current value becomes our "last read value" before looping again
  lastValue = currentValue;
} // Rinse and repeat.

There's a DoMagic in there, because that's a complex sentence there. From which range would you want the maximum? Which two points would the -6dB points be? Do you want to use a fixed window size?

If you can describe that in simple terms, you can complete the code Smile | :)
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]

GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Krellon1-Feb-18 12:44
Krellon1-Feb-18 12:44 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Eddy Vluggen1-Feb-18 13:45
professionalEddy Vluggen1-Feb-18 13:45 
AnswerRe: Peak Search Algorithm with sliding window and peak excursion Pin
Gerry Schmitz1-Feb-18 10:25
mveGerry Schmitz1-Feb-18 10:25 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Krellon1-Feb-18 12:17
Krellon1-Feb-18 12:17 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Gerry Schmitz1-Feb-18 12:46
mveGerry Schmitz1-Feb-18 12:46 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Eddy Vluggen1-Feb-18 14:36
professionalEddy Vluggen1-Feb-18 14:36 
QuestionHow do I make a program that reacts to a specific word entered on the keyboard? Pin
Member 1365479431-Jan-18 15:11
Member 1365479431-Jan-18 15:11 
AnswerRe: How do I make a program that reacts to a specific word entered on the keyboard? Pin
Dave Kreskowiak31-Jan-18 16:11
mveDave Kreskowiak31-Jan-18 16:11 
GeneralRe: How do I make a program that reacts to a specific word entered on the keyboard? Pin
Member 1365479431-Jan-18 17:04
Member 1365479431-Jan-18 17:04 
AnswerRe: How do I make a program that reacts to a specific word entered on the keyboard? Pin
BillWoodruff31-Jan-18 19:54
professionalBillWoodruff31-Jan-18 19:54 
GeneralRe: How do I make a program that reacts to a specific word entered on the keyboard? Pin
Member 136547942-Feb-18 10:25
Member 136547942-Feb-18 10:25 
AnswerRe: How do I make a program that reacts to a specific word entered on the keyboard? Pin
OriginalGriff31-Jan-18 21:02
mveOriginalGriff31-Jan-18 21:02 
AnswerRe: How do I make a program that reacts to a specific word entered on the keyboard? Pin
Gerry Schmitz1-Feb-18 7:53
mveGerry Schmitz1-Feb-18 7:53 
QuestionIs it possible to make a class whose objects are castable into ints? Pin
arnold_w31-Jan-18 10:33
arnold_w31-Jan-18 10:33 
AnswerRe: Is it possible to make a class whose objects are castable into ints? Pin
Dave Kreskowiak31-Jan-18 11:24
mveDave Kreskowiak31-Jan-18 11:24 
GeneralRe: Is it possible to make a class whose objects are castable into ints? Pin
arnold_w6-Feb-18 0:25
arnold_w6-Feb-18 0:25 
QuestionRe: Is it possible to make a class whose objects are castable into ints? Pin
Eddy Vluggen31-Jan-18 13:15
professionalEddy Vluggen31-Jan-18 13:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.