Standard deviation,variance and mean

Mayou's icon

Hello,

I would like to know what is the best way to get the standard deviation sigma, variance V and mean E of a stream of data in real time ?

I would like my signal S(x) to be always centered and divided by std :

(s(x)-E(x))/sigma

For the mean I am using the example 4 in the help file of mean object (Mean + bucket), do you think it is a good solution ?

Thanks a lot,

Have a nice day,

Mathieu

GGH's icon

You can use the mean object in order to get the average of a real time sampled data signal. And use a set of expr objects to calculate the standard deviation formula. sigma = SQRT(SUM(x^2)/n - (SUM(x)/n)^2) something to that affect (there's loads of online material covering the formulae.

Luke Hall's icon

Peter Castine's Litter bundle contains [lp.stacey] which I've found useful for this type of task before.

lh

Mayou's icon

Thanks to both of you.
I have tried to use lp bundle placing the folder in max folder with a new path in "file preferences" but it leads to error 127 loading external lp.stacey. But max detects it when I create a new object, lp.stacey appears in the list.

My path is : C:Program FilesCycling '74Max 5.0Cycling '74 and I have placed the folder here.

Do I have to separate help, externals, etc. ?

The pdf installation help file says its better but I am not sure about the folders I have to choose on max 5. init, Jitter help, jitter externals and extras ? only jitter sections ?

Mayou's icon

It seems there is a problem with init.txt files or files.mxb I have to place in Patches/extras folders

Luke Hall's icon

I think the free version of the Litter bundle is still max4, only the Pro bundle is updated to max5 so you might get something printed to the max window. The object still instantiates and works fine on my machine even if it does throw an error message.

lh

Mayou's icon

It does throw an error message in max window but also an error message in a WinXP window and the lp.stacey appears in red in the patch without inlet or outlet. I have tried these 2 solutions :

- Adding a path in file preferences.
- Separating the externals, helpfiles, etc. in the right files.

But it does not work :(

I have this pack : LPStarterPack.W-1.5

containing :
- Litter Extras
- Litter Help
- Litter Init
- Litter Objects for Windows XP

Mathieu

seabed's icon

Hey, these all look useful in a real-time process. What about a non real-time operation?

Lets say that I load a sample in a buffer. Is there any way to have instantly the mean and the variance of the loaded sample?

sabo's icon
Max Patch
Copy patch and select New From Clipboard in Max.

standard variance w/o expr object:

Dario's icon

Im having the same prob with LP starter pack