From: michael on 20 Jul 2010 08:26 hi i need to generate 2 noises kind of samples: white and color the white is easy - randn the color is too: filter the white through a filter (for example y(n)=a*y(n-1)+(1-a)*x(n)) how do i compute the statistics of the noise - the mean vector and variance matrix practically: in case of white noise it's kind of easy - all with the same distribution so i can use the mean and var functions in color - each sample is with it's own variance and also covariance is needed, so it's problematic to compute.
From: Wayne King on 20 Jul 2010 09:29 "michael" <bezenchu(a)gmail.com> wrote in message <i244ks$ovd$1(a)fred.mathworks.com>... > hi > > i need to generate 2 noises kind of samples: white and color > the white is easy - randn > the color is too: filter the white through a filter (for example y(n)=a*y(n-1)+(1-a)*x(n)) > > how do i compute the statistics of the noise - the mean vector and variance matrix > > practically: > in case of white noise it's kind of easy - all with the same distribution so i can use the mean and var functions > in color - each sample is with it's own variance and also covariance is needed, so it's problematic to compute. Hi Michael, For a number of random processes, it is possible to determine the mean and variance fairly easiliy. For example, if you generate the colored noise as a wide-sense stationary AR process of some order (p), there are expressions for the mean and variance of the process as well as an analytic expression for the power spectral density. The derivations of these results are available in most time series analysis texts. As a simple example, take an AR(1) model of the form: y(n)=0.9y(n-1)+e(n) where e(n) is zero-mean white noise process. Since the coefficient, 0.9, is smaller in absolute value than 1, the above is a wide-sense stationary random process (it corresponds to a low pass system) you can see that with: fvtool(1,[1 -0.9]) % Now let's get a realization of this AR(1) process A = [1 -0.9]; % resetting the random number generator so you can get % reproducible results reset(RandStream.getDefaultStream) y = filter(1,A,randn(1000,1)); for this AR(1) process the variance is \sigma^2/(1-0.9^2) where \sigma^2 is the variance of the white noise input For this example, we should have VarAr1 = 1/(1-0.9^2) which you should find is pretty close to var(y) % 5.7090 Obviously, for higher order stationary AR models, the variance becomes a more complicated expression of the parameters. Hope that helps get you started, Wayne
From: michael on 20 Jul 2010 10:12 thank you can you give me some reference? what about the color? doesn't the different variables have different distributions?
From: Wayne King on 20 Jul 2010 10:26 "michael" <bezenchu(a)gmail.com> wrote in message <i24ark$84u$1(a)fred.mathworks.com>... > thank you > > can you give me some reference? > > > what about the color? doesn't the different variables have different distributions? Hi, Perival and Walden, Spectral Analysis for Physical Applications Priestly, M.B. Spectral Analysis and Time Series Brockwell and Davis Time Series: Theory and methods As just a few examples. The term "colored" just indicates that the theoretical autocorrelation is not zero at non-zero lags. People use different colors as common descriptions of various shapes imparted to the PSD. Red noise is commonly used to refer to an AR(1) process for example. The example I gave you produces a colored noise, i.e. the filtering of the white noise introduces autocorrelation. Wayne
|
Pages: 1 Prev: how to find currently focussed uicontrol Next: How to update legend when delete a plot line? |