Re: Moving average / smoothing data
- To: mathgroup at smc.vnet.net
- Subject: [mg64081] Re: [mg64063] Moving average / smoothing data
- From: "Carl K. Woll" <carlw at wolfram.com>
- Date: Tue, 31 Jan 2006 01:14:38 -0500 (EST)
- References: <200601300410.XAA29456@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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 > Have you looked into the Statistics`DataSmoothing` package? For example: Needs["Statistics`DataSmoothing`"] data = Table[{x, 1.5 Sin[x] + .5 Sin[20x]}, {x, 0, 20, .1}]; smoothed = MovingAverage[data, 10]; Show[{ ListPlot[smoothed, PlotJoined -> True, DisplayFunction -> Identity], ListPlot[data, DisplayFunction -> Identity]}, DisplayFunction -> $DisplayFunction] You could also check out LinearFilter and ExponentialSmoothing. Carl Woll Wolfram Research
- References:
- Moving average / smoothing data
- From: "Lea Rebanks" <lrebanks@netvigator.com>
- Moving average / smoothing data