MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Moving average / smoothing data

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64066] Re: Moving average / smoothing data
  • From: dh <dh at metrohm.ch>
  • Date: Tue, 31 Jan 2006 01:14:11 -0500 (EST)
  • References: <drk45d$stj$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Lea,
in your signal, the information and the "noise" are clearly 
distinguished by their frequency. Therefore, "Digital Filters" is the 
tool of choice. Application of Digital that you may find in a text book 
about signal processing.
Here is an simple example (note that the filters depend on the sampling 
rate):

tt=1.5*Sin[x]+0.5*Sin[20*x];
dat = Table[tt, {x, 0, 20, .1}];

fil5={-0.0839161, 0.020979, 0.102564, 0.160839, 0.195804, 0.207459, 
0.195804,0.160839, 0.102564, 0.020979, -0.0839161}
fil10={-0.0559006, -0.0248447,
    0.00294214, 0.02746, 0.0487087, 0.0666885, 0.0813992, 0.0928408, 
0.101013,0.105917, 0.107551, 0.105917, 0.101013, 0.0928408, 0.0813992, 
0.0666885,0.0487087, 0.02746, 0.00294214, -0.0248447, -0.0559006}
fil15={-0.0410557, -0.026393, -0.0127414, -0.000101122, 0.011528, 0.0221458,
    0.0317525, 0.0403479, 0.047932, 0.054505, 0.0600667, 0.0646173, 
0.0681565,0.0706846, 0.0722014, 0.072707, 0.0722014, 0.0706846, 
0.0681565, 0.0646173,0.0600667, 0.054505, 0.047932, 0.0403479, 
0.0317525, 0.0221458, 0.011528,-0.000101122, -0.0127414, -0.026393, 
-0.0410557}

ListPlot[ListConvolve[fil5, dat]]
ListPlot[ListConvolve[fil10, dat]]
ListPlot[ListConvolve[fil15, dat]]

Daniel


Lea Rebanks wrote:
> Hi All,
> 
> Given the following function & subsequent plot.
> 
> tt={1.5*Sin[x]+0.5*Sin[20*x],1.5*Sin[x]};
> pp=Plot[Evaluate[tt],{x,0,20}];
> 
> 
> I am trying to get the best smoothing / moving average function closest 
> to the underlying 1.5*sin[x]
> 
> Has anyone got any suggestions? Please show coding in reply so I can 
> plot & see result.
> 
> I have similar noise on exponential data, so hopefully 
> the moving average you recommend will work on that too.
> 
> Many thanks for your attention.
> 
> Lea Rebanks...
> 
> PS  I am using version 5.1
> 
> 


  • Prev by Date: Re:implementation of Granger causality tests in Mathematica
  • Next by Date: Re: Re: General--A Minor Annoyance
  • Previous by thread: Re: Moving average / smoothing data
  • Next by thread: Substitution inside an SQLExecute statement