Or you could use interpolate (from PD::Func) for resampling.
Ingo
On 05/09/2012 01:07 AM, Craig DeForest 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).
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] <mailto:[email protected]>
_______________________________________________
Perldl mailing list
[email protected] <mailto:[email protected]>
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
_______________________________________________
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