# autocovariance in matlab

Started by January 6, 2006
```Hi,

I have a MATLAB related question. I have a periodic signal loaded into
Matlab and i am trying to estimate the Autocovariance of it by using the
xcov command.

This gives me an output that i store as a variable. I'd just like to know
if anyone knows why:

a) the xcov matrix is twice as long as the original signal  and;

b) how can i, from the xcov result see the periodicity of the waveform...
I mean i can SEE it visually when i plot the graph, but not measure it
accurately.

Any help would be very much appreciated.

Thankyou,

James

```
```Wookie wrote:
> Hi,
>
> I have a MATLAB related question. I have a periodic signal loaded into
> Matlab and i am trying to estimate the Autocovariance of it by using the
> xcov command.
>
> This gives me an output that i store as a variable. I'd just like to know
> if anyone knows why:
>
> a) the xcov matrix is twice as long as the original signal  and;

Is it a matrix or a vector? The difference is that a vector is of
dimension
M x 1 (or 1 x M) for some general M. That is, one of the dimensions is
1.
A matrix is of dimension N x M where both N and M are different from 1.

Assuming you get a vector, not a matrix, at the output, you will find
that the length of the output is 2N-1 where N is the length of the
input signal. This follows directly from the covariance fomula, where
the
non-zero elements furthest away from 0 are at +/-N-1. Just play with
the covariance formula to see this.

> b) how can i, from the xcov result see the periodicity of the waveform...
> I mean i can SEE it visually when i plot the graph, but not measure it
> accurately.

You see the periodic behaviour of the signal as to big "lumps" in
the covariance sequence, at k = +/- M, where M is the period
of the input signal.

Rune

```
```Hi,

Thanks for the help, I was able to do what i wanted in the end.... i
understand the "doubling" thing i wasn't sure of...duh!

Thanks again,

James
```