[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Vectorize a moving average calculation
From: |
Ozzy Lash |
Subject: |
Re: Vectorize a moving average calculation |
Date: |
Mon, 3 Nov 2008 15:26:31 -0600 |
On Mon, Nov 3, 2008 at 3:01 PM, babelproofreader
<address@hidden> wrote:
>
> I would like to calculate various moving averages, FIR filters etc. which
> rely on previously calculated values of said averages and filters e.g. an
> exponential moving average is of the form alpha*ValueToday +
> (1-alpha)*ValueYesterday. How does one use vectorized code to calculate such
> things?
I think the filter function will do what you want. For your example
you should be able to use:
y=filter(alpha,[1,-(1-alpha)],x)