On Tue, May 8, 2012 at 6:07 PM, Craig DeForest <[email protected]>wrote:

> Hey, Scott,
>
> Are you interested in decimation, or merely in smoothing?
>
> If the latter:
> $y2 = $y->convolveND(ones($n)/$n);
>
> If the former:
> $y2 = $y->copy->reshape($n, $nbins)->average;
> or even
> $y2 = $y->convolveND(ones($n)/$n)->(0:-1:$n);
>
> (but that last is a bit wasteful).
>

I'm not very familiar with smoothing techniques, but I suspect that you'll
want to use the autocorrelation to figure out the approximate periodicity
of the signal (if it is indeed periodic) and smooth over some multiple of
the signal's period. For that, it looks like PDL::Stats has what you need:
http://search.cpan.org/~maggiexyz/PDL-Stats-0.6.2/TS/ts.pp

David


> On May 8, 2012, at 4:54 PM, Scott Penrose wrote:
>
> Good morning
>
> To debug a bit of hardware lately, I am plotting a simple wave, which
> deteriates over time.
>
>   use PDL;
>   use PDL::Graphics::PGPLOT;
>   dev('/XSERVE');
>   $x = sequence(1000)/10;
>   $y = sin($x) - log($x)/.5;
>   line $x, $y;
>
> (not very realistic to my real data, but gives you an idea).
>
> What I want is:
>
>   use PDL;
>   use PDL::Graphics::PGPLOT;
>   dev('/XSERVE');
>   $x = sequence(1000)/10;
>   $y = sin($x) - log($x)/.5;
>   line $x, $y;
>   hold;
>   $z = -log($x)/.5;
>   line $x, $z;
>
> To get that, I think the best data would come from a boxed average (e.g.
> average of every 10 points). There are better fitting routines like
> Gaussian etc, but I don't think it will be as good in this case.
>
> So my real question, is how do I turn my $y into an average of every 10
> entries, obviously then 1/10th the dimensions, so I need to turn $x into
> every 10th for plotting.
>
> Thanks
>
> Scott
>
> --
> http://scott.dd.com.au/
> [email protected]
>
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>
>
>
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>
>


-- 
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to