If you simply want to reduce the number of points, use a decimation procedure. For example if you want to eliminate half the points, sort the points on the x or y axis and throw out the odd numbered points, keeping the even points.

If your goal is to somehow approximate the curve that these points lie upon, you want to do some sort of regression, that is, create a statistical model of the process generating the points and fit the parameters of the model. An example module that would do this in the linear case is Statistics::Regression. From the synopsis:

use Statistics::Regression; # Create regression object my $reg = Statistics::Regression->new( 3, "sample regression", [ "const", "someX", "someY" ] ); # Add data points $reg->include( 2.0, [ 1.0, 3.0, -1.0 ] ); $reg->include( 1.0, [ 1.0, 5.0, 2.0 ] ); $reg->include( 20.0, [ 1.0, 31.0, 0.0 ] ); $reg->include( 15.0, [ 1.0, 11.0, 2.0 ] ); # Print the result $reg->print(); # Prints the following: # **************************************************************** # Regression 'sample regression' # **************************************************************** # Theta[0='const']= 0.2950 # Theta[1='someX']= 0.6723 # Theta[2='someY']= 1.0688 # R^2= 0.808, N= 4 # **************************************************************** # Or, to get the values of the coefficients and R^2 my @theta = $reg->theta; my $rsq = $reg->rsq;

-Mark


In reply to Re: Module/Algorithm to reduce data points? by kvale
in thread Module/Algorithm to reduce data points? by saintmike

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.