Click here to Skip to main content
15,891,409 members
Home / Discussions / C#
   

C#

 
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 
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 
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 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 
AnswerRe: Is it possible to make a class whose objects are castable into ints? Pin
BillWoodruff5-Feb-18 18:51
professionalBillWoodruff5-Feb-18 18:51 
GeneralRe: Is it possible to make a class whose objects are castable into ints? Pin
arnold_w6-Feb-18 0:34
arnold_w6-Feb-18 0:34 
Questionautomatic start, Pin
Member 1363217131-Jan-18 3:55
Member 1363217131-Jan-18 3: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.