in reply to Data averages by time of day
Approximation minimizes distance between the curve and each of the datapoints (the datacloud) to produce exactly what you want: a function to calculate useful value in any point of the X axis.
Give Math::Approx a try. Like this:
my %data = ( mins_from_midnight('07:01') => 82, mins_from_midnight('23:48') => 188, # ... ); my $approx = Math::Approx->new(undef, 3, %data); print $approx->approx(mins_from_midnight('15:40'));
Update: and yes, the day you took a specific datapoint does not matter. Anyway, you want average and that means all the days are the same for your task. That's ok.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Data averages by time of day
by blue_cowdawg (Monsignor) on Feb 26, 2004 at 19:34 UTC | |
|
Re: Re: Data averages by time of day
by tsee (Curate) on Feb 28, 2004 at 18:48 UTC |