<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258938</link>
    <title>MATLAB Central Newsreader - moving average</title>
    <description>Feed for thread: moving average</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 20 Aug 2009 04:45:54 -0400</pubDate>
      <title>moving average</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258938#674436</link>
      <author>MZ</author>
      <description>I have paired (x,y) data.  I want to compute a sort of moving average on &lt;br&gt;
it, and I want values returned at the same values of x.  The kink is &lt;br&gt;
that the x data is not equally spaced.&lt;br&gt;
&lt;br&gt;
I've solved the problem this way:&lt;br&gt;
&lt;br&gt;
y = &lt;br&gt;
ksdensity(x,x,'kernel','box','weights',y)./ksdensity(x,x,'kernel','box');&lt;br&gt;
&lt;br&gt;
But it's dreadfully slow.  I have to call ksdensity twice, once with &lt;br&gt;
weighting and once without.  The first one is to basically sum the &lt;br&gt;
points within a kernel and the second one is to count the points within &lt;br&gt;
a kernel.  (ie. mean=sum/N)&lt;br&gt;
&lt;br&gt;
[The size of the kernel isn't terribly important, so I've stuck with the &lt;br&gt;
defaults.]&lt;br&gt;
&lt;br&gt;
Is there a better way to do this?  I thought about rounding + &lt;br&gt;
convolution, but it would require interpolation and I'm not sure how &lt;br&gt;
willing I am to put up with roundoff error.  Although at this stage, it &lt;br&gt;
might be worth it...</description>
    </item>
  </channel>
</rss>

