Click here to Skip to main content
15,845,785 members
Home / Discussions / C#
   

C#

 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Eddy Vluggen1-Feb-18 2:37
professionalEddy Vluggen1-Feb-18 2:37 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Krellon1-Feb-18 3:47
Krellon1-Feb-18 3:47 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Eddy Vluggen1-Feb-18 4:21
professionalEddy Vluggen1-Feb-18 4:21 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Krellon1-Feb-18 5:07
Krellon1-Feb-18 5:07 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Eddy Vluggen1-Feb-18 10:25
professionalEddy Vluggen1-Feb-18 10:25 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Krellon1-Feb-18 13:44
Krellon1-Feb-18 13:44 
GeneralRe: Peak Search Algorithm with sliding window and peak excursion Pin
Eddy Vluggen1-Feb-18 14:45
professionalEddy Vluggen1-Feb-18 14:45 
AnswerRe: Peak Search Algorithm with sliding window and peak excursion Pin
Gerry Schmitz1-Feb-18 11:25
mveGerry Schmitz1-Feb-18 11:25 
using System;

namespace ConsoleApplication10 {

   class Program {

      static void Main( string[] args ) {

         double[] trace = new double[] {
            47.92370605, 44, 49, 46.31715393, 44.98129654, 46.17653275,
            78, 73, 82, 63, 69, 41.72979736, 41.13000488, 41.49586487,
            37, 40, 30, 40.79894257, 40.65593719, 41.37298584, 39.13498688,
            55, 51, 60, 39.3440094, 38.51491547, 42, 35.12589264 };

         double low = trace[ 0 ];
         double previous = trace[ 0 ];
         double peak = trace[ 0 ];

         for ( int i = 1; i < trace.Length; i++ ) {

            double current = trace[ i ];

            if ( current > previous ) {
               peak = current;
            } else {
               if ( current < previous ) {
                  if ( ( peak - low >= 6.0 ) && ( peak - current >= 6.0 ) ) {
                     Console.WriteLine( $"Peak: {peak} @{i}" );
                     low = peak = current;
                  }
               }
            }

            previous = current;

         }  // end for.

         Console.ReadKey();
      }

   }  // end class.
}
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal

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

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.