Algorithm-CurveFit

 view release on metacpan or  search on metacpan

examples/examplefit.pl  view on Meta::CPAN

use lib '../lib';
use Algorithm::CurveFit;

my $formula = 'b*cos(x/10)+c*sin(x/10)';
my $variable = 'x';
my @xdata;
my @ydata;

unless (@ARGV) {
    die <<HERE;
Usage: $0 DATAFILE
Fits b*cos(x/10)+c*sin(x/10) to the data in DATAFILE.
HERE
}

open my $fh, '<', shift @ARGV or die $!;
while (<$fh>) {
	chomp;
	my @ary = split ' ';
	push @xdata, $ary[0];
	push @ydata, $ary[1];
}



( run in 0.944 second using v1.01-cache-2.11-cpan-140bd7fdf52 )