in reply to Re^2: Any idea for predicting the peak points in the graph by perl
in thread Any idea for predicting the peak points in the graph by perl
The following is a start. Input is not validated. Adjacent "peak" points with the same y value will be skipped -- you'll need to add some code for that. "Peak" points that occur on the first or last data point will be skipped. There may be an error on the first pair with some input.
Untested:
Have the Homework Police cleared this yet?#!/your/perl/here use strict; use warnings; my $last_sign; my $last_y; my $last_x; while (<>) { my ($x,$y) = split; my $sign = $y <=> $last_y; if ( $last_sign <=> $sign ) { print "$last_x $last_y\n"; } $last_x = $x; $last_y = $y; $last_sign = $sign; }
-QM
--
Quantum Mechanics: The dreams stuff is made of
|
|---|