# Moving average filter for MC solution of PDE

#### kai_sikorski

Gold Member
I have a PDE that can be interpreted as basically an exit time problem for a certain stochastic process. I would like to use this to verify an analytical solution I've found. If I start the stochastic process at (x,y), then the average exit time from a certain region will be equal to the value of the solution of the PDE I care about at (x,y).

I could divide up my region into a discrete set of points and find the average for each of those. However that wastes some of the data because, say I start the process at x0, y0. During the next time step the position is x1, y1, and so if the total exit time is T then not only do I have the data point

x0, y0, T

but also

x1, y1, T - dt

However x1, y1 is probably not exactly one of any predefined start points I defined.

So what I would like to do is take the whole list of data

{ { x0, y0, T}, {x1, y1, T-dt}, {x2, y2, T- 2 dt}, ... }

And apply a moving average filter. Is there a built in method for doing this in Matlab or Mathematica? I can find documentation for things like the filter2 command in Matlab, this seems to apply more to a case where your data is indexed by a discrete sets of points so that you can arrange it in for example a matrix. That's not the case here where the data is basically indexed by floats.

Related Math Software Workshop News on Phys.org

"Moving average filter for MC solution of PDE"

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving