A little while ago, I needed to find the rotation angle of a flat object in an image, so sampling the edge and finding the line was the way to go. What I eventually went with was:
use strict; use warnings; use Statistics::LineFit; use Math::Trig; ... my $lineFit = Statistics::LineFit->new(); my @x = map {$_->{col}} @edgeSamples; my @y = map {$_->{row}} @edgeSamples; unless ($lineFit->setData(\@x, \@y)) { print "Invalid data sample for regression; could not calculate + skew for $inFile\n"; next; } ... my ($intercept, $slope) = $lineFit->coefficients(); my $angle = atan($slope); $angle *= 180/3.14159265359; ...
Now, that does linear interpolation, but I would expect mass loss to be more of a noisy exponential decay towards the final value than linear. If it turns out to actually be a problem you could try resorting to piecewise linear interpolation, or use a fancy high-order plotting package.
In reply to Re: Interpolating data slope for multiple points
by SuicideJunkie
in thread Interpolating data slope for multiple points
by oko1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |