in reply to Any idea for predicting the peak points in the graph by perl

This is what I would do:

my $max = [ $x[ 0 ], $y[ 0 ] ]; for my $i ( 1..$#x ) { last if $y[ $i ] <= $max[ 1 ]; $max = [ $x[ $i ], $y[ $i ] ]; } print "max at ($max->[ 0 ], $max->[ 1 ])\n";

This code makes two important assumptions: that your data is ordered in the x-axis and that it is really as smooth as you describe it. If neither of these two assumptions hold, the following would be better:

my $max = [ $x[ 0 ], $y[ 0 ] ]; for my $i ( 1..$#x ) { $max = [ $x[ $i ], $y[ $i ] ] if $y[ $i ] > $max->[ 1 ]; } print "max at ($max->[ 0 ], $max->[ 1 ])\n";

the lowliest monk

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.