Re: Generate random numbers and find their autocorrelation function



Here's how to calculate "running" mean and std:

% begin script

N_data_at_time = 100;
N_times_intopc = 200;
Data = rand(1,N_data_at_time*N_times_intopc);
moment0 = 0;
moment1 = 0;
moment2 = 0;

for ii = 1:N_times_intopc-1
stream_data_to_pc = Data(1+ii*N_data_at_time:
(1+ii)*N_data_at_time);
moment0 = moment0 + numel(stream_data_to_pc);
moment1 = moment1 + sum(stream_data_to_pc);
moment2 = moment2 + sum(stream_data_to_pc.^2);
end

mean_value = moment1/moment0;
std_vaule = sqrt((moment2 - mean_value*moment1)/(moment0 -1));

% check
mean_value - mean(Data)
std_vaule - std(Data)

% end script

The idea is to accumulate moments of the distribution and then
calculate mean and std from them. There are more accurate methods of
calculating "running" stats. See:

http://en.wikipedia.org/wiki/Standard_deviation

Calculation of autocorrelation will be more complicated. How big is
the window over which you want to calculate autocorrelation?

Cheers,

Tomek
.



Relevant Pages

  • Re: UDF and SQL2000 - Why doesnt this work?
    ... >I have pasted the script below so you can test it out. ... >calculating the dependence of utility meters on outside parameters. ... WHERE VariableCode = @Var ... MS might choose to change internal storage of datetime values in the ...
    (microsoft.public.sqlserver.programming)
  • Re: Robocopy kopiert nicht kompletten Inhalt beim Shutdown der Rechner
    ... Oder wie kann ich den TimeOut Wert höher ... auf 3 Std. ... Maximale Wartezeit auf 0 stellen, dann wird solange gewartet, bis das ... Script zu Ende gelaufen ist. ...
    (microsoft.public.de.german.windows.server.active_directory)
  • Re: Robocopy kopiert nicht kompletten Inhalt beim Shutdown der Rechner
    ... auf 3 Std. ... Maximale Wartezeit auf 0 stellen, dann wird solange gewartet, bis das ... Script zu Ende gelaufen ist. ... Connect2WSUS: http://www.grurili.de/tools/Connect2WSUS.exe ...
    (microsoft.public.de.german.windows.server.active_directory)
  • Re: calculating odds in Holdem
    ... Let me put this another way, again quoting Gordon's number and comparing that to the output of another script I wrote. ... Calculating odds as a percentage: ...
    (rec.gambling.poker)
  • Re: Auto-backup of ISA 2004 Std Config.
    ... Specifically the ImportExport.vbs script. ... Is there a way to automatically schedule backups of just the ISA 2004 Std ...
    (microsoft.public.isaserver)