comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » mean() function
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: mean() function [message #46976 is a reply to message #46938] Fri, 13 January 2006 00:57 Go to previous messageGo to previous message
Maarten[1] is currently offline  Maarten[1]
Messages: 176
Registered: November 2005
Senior Member
savoie@nsidc.org wrote:

> Would you mind explaining this a bit for me? What's a proper running
> average? And why is it better in general?

It assumes that values are resonably close the the average,
mathematically it is equivalent to taking the total, and then dividing,
but it avoids some precision problems.

In IDL code it requires an explicit loop over the data, which is slow.
An alternative is to do everything in double precision, but that is
just postponing the inevitable.

Code to calculate the mean in an array X:

mean = 0.
for ii = 0, n_elements(X)-1 do $
mean += (X[ii] - mean) / (ii + 1)

Maarten
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: mean() function
Next Topic: ASP.NET vs JSF

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 05:51:39 PDT 2025

Total time taken to generate the page: 0.88403 seconds