Re: Generate random numbers and find their autocorrelation function
- From: t.m.trzeciak@xxxxxxxxx
- Date: Tue, 23 Sep 2008 13:57:38 -0700 (PDT)
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
.
- Follow-Ups:
- Re: Generate random numbers and find their autocorrelation function
- From: t . m . trzeciak
- Re: Generate random numbers and find their autocorrelation function
- From: Sathu
- Re: Generate random numbers and find their autocorrelation function
- References:
- Prev by Date: Register one image with another that has been both translated and
- Next by Date: Re: Surface from a 3D point Set and its area
- Previous by thread: Re: Generate random numbers and find their autocorrelation function
- Next by thread: Re: Generate random numbers and find their autocorrelation function
- Index(es):
Relevant Pages
|