From: Marcus (Mechanical Engineering) on
On 12 ago, 11:39, "Rogelio " <rogel...(a)math.uio.no> wrote:
> "Marcus (Mechanical Engineering)" <marcus.co...(a)gmail.com> wrote in message <e25ff48e-c383-47bb-9658-6d9e373f1...(a)d8g2000yqf.googlegroups.com>...
>
>
>
>
>
> > On 12 ago, 10:54, "Rogelio " <rogel...(a)math.uio.no> wrote:
> > > "Marcus (Mechanical Engineering)" <marcus.co...(a)gmail.com> wrote in message <67025bf5-221d-4c0c-b8b1-dae2aa10b...(a)d8g2000yqf.googlegroups.com>....
>
> > > > Hi,
>
> > > > (Exercise)
> > > > "Generate a set of N random signs u(k), with the same variance and
> > > > dimension n. For each signs estimate its autocorrelation function
> > > > Ruu(k). Plot one of the estimatives of Ruu(k) (use the command xcorr)
> > > > and plot the Expected value E[ Ruu(k) ]. Consider that each sign with
> > > > dimension n=1000 and N=10 or N=100 or N=1000."
>
> > > > I'm tring to understand the following step:" For each signs estimate
> > > > its autocorrelation function Ruu(k)"
>
> > > > I now that autocorrelation function it's a plot.
> > > > Suppose N = 5 (five samples) in this case we get 5 arrays with
> > > > dimension 1000.
>
> > > > I ask: There is an autocorrelation function to each N or this function
> > > > must be obtained using all the samples?
>
> > > > Thanks
>
> > > Can you clarify a bit your exercise? As I understand you will simulate a n x M matrix. whre each column is a sign. Then the autocorrelation is not a plot, it is a measure of comovment of one variable with respect to its onw lags. Of course you can plot its value. Since it is a measure of comovement with respect to its own lags you can always calculate it with respect to many different lags, say up to 15 lags. Be aware that matlab offers different ways of normalize the autocovariance function in order to obtain the autocorrelation function. Hence you get the same definition than in the book you are using.
>
> > Hi, thanks for answer!
> > I will try to write again the exercise...
>
> > "Generate a collection of N random signals u (k) with the same
> > variance and same dimension n.
> > For each of the signals to estimate their autocorrelation function Ruu
> > (k).
> > Construct the graph of estimated Ruu a (k) (use the command xcorr) and
> > graph of its expected value E [Ruu (k)].
> > Consider n = 1000 and N = 10."
>
> > Below the code I'm using in Matlab:
>
> > N=1000;
> > x=randn(N,10);
> > k=size(N);
> > for i=1:1:N
> >   k(i)=i;
> > end
> > subplot(2,1,1);
> > plot(k,x);
> > title('Random signal');
> > xlabel('k');
> > ylabel('Signal');
> > grid;
> > Rxx=xcorr(x);  %autom(x);
> > subplot(2,1,2);
> > plot(Rxx);
> > grid;
> > title('Random signal autocorrelation function');
> > xlabel('lags');
> > ylabel('Autocorrelation');
>
> > This is an exercise of "Introduction of System Identification".
>
> > Thanks
>
> Modify this
>
> > Rxx=xcorr(x);  % You only have 10 different signals so you only have 10
>
>                         % autocorrealations
>
> check my suggestion
>
> lags=15;
> n=10;  %signals
> coerrmat=zeros(n,lags);
> for i=1:10
> coerrmat(i,:)=xcorr(x(:,i),x(:,i));
> end
> plot(coerrmat')
>
> The autocorreation is symetric around lag=0. Check the normalizing factor that you need.

Rogelio,

Thanks, I'll try.