Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: filtering data

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25391] Re: filtering data
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 29 Sep 2000 01:06:22 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <8qhmu2$j06@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,


try this,

MyFilter[p_?NumericQ, y_, x_, xp1_] := (1 - p)*y + p*((1 - p)*x + xp1)/2
MyFilter[p_?NumericQ, y_List, x_List] := 
  Drop[MyFilter[p, y, x, RotateLeft[x]], -1]

I can't reproduce the crash because I have a Octane wit 768 MB RAM.

You should not try to print out the result in the Frontend.
The formating of a huge data set cost time and memory.

Regards
  Jens


steven.w.gaskey at exxon.com wrote:
> 
> I am trying to apply a type of filter to a series of data. The filter is of the form
> 
> y(i+1) = (1-p) y(i) + p/2 ( (1-p) x(i) + x(i+1)).
> 
> where y is the filtered data series and x is the raw data series.
> 
> First, I implemented this by defining the function for the single step then using FoldList to calculate the filtered series.
> 
> BAStep[abai_, p_, {ai_, aip1_}] := (1 - p)abai + p/2((1 - p)ai + aip1)
> 
> BA[a_, p_] := FoldList[BAStep[#1, p, #2] &, a[[1, 1]], a]
> 
> Everything worked fine. However, this required me to partition the list first:
> 
> ap = Partition[a,2,1].
> 
> When I moved the partition into the definition of the BA function:
> 
> BA2[a_, p_] := FoldList[BAStep[#1, p, #2] &, First[a], Partition[a, 2, 1]]
> 
> The application of the function got very slow and used a huge amount of memory. I applied this to two lists of 1500 points and it used all the system memory, crashed the front end and froze the kernel.
> 
> My questions:
> 
> 1. Is there a better way to implement a filter such as this.
> 
> 2. What was the cause of the large use of memory and long time in applying the filter?


  • Prev by Date: Re: About N in Mathematica 4
  • Next by Date: Re: Linux/Unix add-ons
  • Previous by thread: Re: filtering data
  • Next by thread: Progress Meter