DSPRelated.com
Forums

autocorrelation of a downsampled signal

Started by Thierry July 12, 2009
Hi Guys,
forgive me but it has been 10 years since i took a course in signal
processing. i am doing some simulations and i need the expression of
the autocorrelation (Rx') of a signal after downsampling using the
autocorrelation (Rx) of the unsampled signal.

I think it should be :Rx'(n)=(1/M).Rx(n.M).
However, when i use the matlab xcorr function  with M=2, the results
don't adhere to the above formula, any help please.

Cheers.
On 13 Jul, 02:25, Thierry <thierrybi...@googlemail.com> wrote:
> Hi Guys, > forgive me but it has been 10 years since i took a course in signal > processing. i am doing some simulations and i need the expression of > the autocorrelation (Rx') of a signal after downsampling using the > autocorrelation (Rx) of the unsampled signal. > > I think it should be :Rx'(n)=(1/M).Rx(n.M). > However, when i use the matlab xcorr function &#4294967295;with M=2, the results > don't adhere to the above formula, any help please.
What do you mean by 'unsampled signal'? Continuous-time signal? Original discrete-time signal? Apart from that, I don't know if there is a simple expression to compare a down-sampled estimate of Rxx with an original (discrete-time) Rxx. There are (or at least ought to be) band-limiting filters involved, and each coefficient rxx[k] depends on *all* samples in x[n]. Once you throw half or more samples of x[n] away, there is no reason to think you will get easy or convenient expressions for R'xx[k] = E[x[Mn]x[k+Mn]] in terms of Rxx[m] = E[x[n]x[m+n]]. Rune
> Once you throw half or more > samples of x[n] away, there is no reason to think you will get > easy or convenient expressions for R'xx[k] = E[x[Mn]x[k+Mn]] > in terms of Rxx[m] = E[x[n]x[m+n]]. > > Rune
Ok, thanks Rune for your answer. another question, if we sample a signal with Gaussian distribution., will the sampled signal be Gaussian as well? Is there any proportionality between their variances and means,,,,i presume no, using your argument above Cheers
On 14 Jul, 02:44, Thierry <thierrybi...@googlemail.com> wrote:
> > Once you throw half or more > > samples of x[n] away, there is no reason to think you will get > > easy or convenient expressions for R'xx[k] = E[x[Mn]x[k+Mn]] > > in terms of Rxx[m] = E[x[n]x[m+n]]. > > > Rune > > Ok, thanks Rune for your answer. another question, if we sample a > signal with Gaussian distribution., will the sampled signal be > Gaussian as well? Is there any proportionality &#4294967295;between their > variances and means,,,,i presume no, using your argument above
The PDF and the autocorrelation are two different quantities. The PDF says something about the distribution of amplitude values. If you start out with a continuous-time signal with a Gaussian PDF and sample it, I see no reason why the discrete-time signal won't be Gaussian with similar means and variances as the continuous-time case. The autocorrelation, on the other hand, expresses something about the *sequence* of samples, or how the amplitudes are grouped in time. Then you have to consider the 'true' autocorrelation and PDF versus *estimated* values. Since you work with data, you have to analyze the different estimators. Som estimators are poor, some are better. Even if they have the same expected values, different estimators produce different estimates of the same quantities, based on the same data. The devil is in the details. Rune
On Jul 12, 5:25&#4294967295;pm, Thierry <thierrybi...@googlemail.com> wrote:
> Hi Guys, > forgive me but it has been 10 years since i took a course in signal > processing. i am doing some simulations and i need the expression of > the autocorrelation (Rx') of a signal after downsampling using the > autocorrelation (Rx) of the unsampled signal. > > I think it should be :Rx'(n)=(1/M).Rx(n.M). > However, when i use the matlab xcorr function &#4294967295;with M=2, the results > don't adhere to the above formula, any help please. > > Cheers.
Why doesn't Matlab match? Can you show some samples on how you tested it? Downsample-by-2 makes power spectrum density has lower magnitude and wider "shape" while FFT the power spectrum density you will get the downsample autocorrelation.
On 14 July, 18:25, Verictor <stehu...@gmail.com> wrote:
> On Jul 12, 5:25&#4294967295;pm, Thierry <thierrybi...@googlemail.com> wrote: > > > Hi Guys, > > forgive me but it has been 10 years since i took a course in signal > > processing. i am doing some simulations and i need the expression of > > the autocorrelation (Rx') of a signal after downsampling using the > > autocorrelation (Rx) of the unsampled signal. > > > I think it should be :Rx'(n)=(1/M).Rx(n.M). > > However, when i use the matlab xcorr function &#4294967295;with M=2, the results > > don't adhere to the above formula, any help please. > > > Cheers. > > Why doesn't Matlab match? Can you show some samples on how you tested > it? Downsample-by-2 makes power spectrum density has lower magnitude > and wider "shape" while FFT the power spectrum density you will get > the downsample autocorrelation.
Verictor, I don't have the file in front of me. but the program was just few lines, mainly: x=randn(1,1000); y=x(1:2:1000); Rx=xcorr(x,x)/length(x); Ry=xcorr(y,y)/length(y); it is almost everything Cheers
On 18 July, 13:54, Thierry <thierrybi...@googlemail.com> wrote:
> On 14 July, 18:25, Verictor <stehu...@gmail.com> wrote: > > > > > > > On Jul 12, 5:25&#4294967295;pm, Thierry <thierrybi...@googlemail.com> wrote: > > > > Hi Guys, > > > forgive me but it has been 10 years since i took a course in signal > > > processing. i am doing some simulations and i need the expression of > > > the autocorrelation (Rx') of a signal after downsampling using the > > > autocorrelation (Rx) of the unsampled signal. > > > > I think it should be :Rx'(n)=(1/M).Rx(n.M). > > > However, when i use the matlab xcorr function &#4294967295;with M=2, the results > > > don't adhere to the above formula, any help please. > > > > Cheers. > > > Why doesn't Matlab match? Can you show some samples on how you tested > > it? Downsample-by-2 makes power spectrum density has lower magnitude > > and wider "shape" while FFT the power spectrum density you will get > > the downsample autocorrelation. > > Verictor, > I don't have the file in front of me. but the program was just few > lines, mainly: > x=randn(1,1000); > y=x(1:2:1000); > > Rx=xcorr(x,x)/length(x); > Ry=xcorr(y,y)/length(y); > &#4294967295;it is almost everything > > Cheers- Hide quoted text - > > - Show quoted text -
sorry a mistake above, it is rather y=zeros(1,1000); y(1:2:1000)=x(1:2:1000);
On Jul 18, 7:15&#4294967295;am, Thierry <thierrybi...@googlemail.com> wrote:
> On 18 July, 13:54, Thierry <thierrybi...@googlemail.com> wrote: > > > > > > > On 14 July, 18:25, Verictor <stehu...@gmail.com> wrote: > > > > On Jul 12, 5:25&#4294967295;pm, Thierry <thierrybi...@googlemail.com> wrote: > > > > > Hi Guys, > > > > forgive me but it has been 10 years since i took a course in signal > > > > processing. i am doing some simulations and i need the expression of > > > > the autocorrelation (Rx') of a signal after downsampling using the > > > > autocorrelation (Rx) of the unsampled signal. > > > > > I think it should be :Rx'(n)=(1/M).Rx(n.M). > > > > However, when i use the matlab xcorr function &#4294967295;with M=2, the results > > > > don't adhere to the above formula, any help please. > > > > > Cheers. > > > > Why doesn't Matlab match? Can you show some samples on how you tested > > > it? Downsample-by-2 makes power spectrum density has lower magnitude > > > and wider "shape" while FFT the power spectrum density you will get > > > the downsample autocorrelation. > > > Verictor, > > I don't have the file in front of me. but the program was just few > > lines, mainly: > > x=randn(1,1000); > > y=x(1:2:1000); > > > Rx=xcorr(x,x)/length(x); > > Ry=xcorr(y,y)/length(y); > > &#4294967295;it is almost everything > > > Cheers- Hide quoted text - > > > - Show quoted text - > > sorry a mistake above, it is rather > y=zeros(1,1000); > y(1:2:1000)=x(1:2:1000);- Hide quoted text - > > - Show quoted text -
Well, my understanding is that this is not exactly downsample-by-2 as y still has 1000 samples. This is the way for downsample-by-2 (your first lines of code) x = randn(1,1000); y = x(1:2:1000); % y has 500 samples now. You can also use a sine waveform to see your OP equation actually is correct.
On 19 July, 16:09, Verictor <stehu...@gmail.com> wrote:
> On Jul 18, 7:15&#4294967295;am, Thierry <thierrybi...@googlemail.com> wrote: > > > > > > > On 18 July, 13:54, Thierry <thierrybi...@googlemail.com> wrote: > > > > On 14 July, 18:25, Verictor <stehu...@gmail.com> wrote: > > > > > On Jul 12, 5:25&#4294967295;pm, Thierry <thierrybi...@googlemail.com> wrote: > > > > > > Hi Guys, > > > > > forgive me but it has been 10 years since i took a course in signal > > > > > processing. i am doing some simulations and i need the expression of > > > > > the autocorrelation (Rx') of a signal after downsampling using the > > > > > autocorrelation (Rx) of the unsampled signal. > > > > > > I think it should be :Rx'(n)=(1/M).Rx(n.M). > > > > > However, when i use the matlab xcorr function &#4294967295;with M=2, the results > > > > > don't adhere to the above formula, any help please. > > > > > > Cheers. > > > > > Why doesn't Matlab match? Can you show some samples on how you tested > > > > it? Downsample-by-2 makes power spectrum density has lower magnitude > > > > and wider "shape" while FFT the power spectrum density you will get > > > > the downsample autocorrelation. > > > > Verictor, > > > I don't have the file in front of me. but the program was just few > > > lines, mainly: > > > x=randn(1,1000); > > > y=x(1:2:1000); > > > > Rx=xcorr(x,x)/length(x); > > > Ry=xcorr(y,y)/length(y); > > > &#4294967295;it is almost everything > > > > Cheers- Hide quoted text - > > > > - Show quoted text - > > > sorry a mistake above, it is rather > > y=zeros(1,1000); > > y(1:2:1000)=x(1:2:1000);- Hide quoted text - > > > - Show quoted text - > > Well, my understanding is that this is not exactly downsample-by-2 as > y still has 1000 samples. This is the way for downsample-by-2 (your > first lines of code) > x = randn(1,1000); > y = x(1:2:1000); &#4294967295; &#4294967295; &#4294967295;% y has 500 samples now. > > You can also use a sine waveform to see your OP equation actually is > correct.- Hide quoted text - > > - Show quoted text -
You are right Verictor y = x(1:2:1000); the OP equation is correct for a sin signal as it is one frequency, but it might not remain so for a wide bandwidth signal. I should consider the case further ...
On Jul 20, 7:10&#4294967295;am, Thierry <thierrybi...@googlemail.com> wrote:
> On 19 July, 16:09, Verictor <stehu...@gmail.com> wrote: > > > > > > > On Jul 18, 7:15&#4294967295;am, Thierry <thierrybi...@googlemail.com> wrote: > > > > On 18 July, 13:54, Thierry <thierrybi...@googlemail.com> wrote: > > > > > On 14 July, 18:25, Verictor <stehu...@gmail.com> wrote: > > > > > > On Jul 12, 5:25&#4294967295;pm, Thierry <thierrybi...@googlemail.com> wrote: > > > > > > > Hi Guys, > > > > > > forgive me but it has been 10 years since i took a course in signal > > > > > > processing. i am doing some simulations and i need the expression of > > > > > > the autocorrelation (Rx') of a signal after downsampling using the > > > > > > autocorrelation (Rx) of the unsampled signal. > > > > > > > I think it should be :Rx'(n)=(1/M).Rx(n.M). > > > > > > However, when i use the matlab xcorr function &#4294967295;with M=2, the results > > > > > > don't adhere to the above formula, any help please. > > > > > > > Cheers. > > > > > > Why doesn't Matlab match? Can you show some samples on how you tested > > > > > it? Downsample-by-2 makes power spectrum density has lower magnitude > > > > > and wider "shape" while FFT the power spectrum density you will get > > > > > the downsample autocorrelation. > > > > > Verictor, > > > > I don't have the file in front of me. but the program was just few > > > > lines, mainly: > > > > x=randn(1,1000); > > > > y=x(1:2:1000); > > > > > Rx=xcorr(x,x)/length(x); > > > > Ry=xcorr(y,y)/length(y); > > > > &#4294967295;it is almost everything > > > > > Cheers- Hide quoted text - > > > > > - Show quoted text - > > > > sorry a mistake above, it is rather > > > y=zeros(1,1000); > > > y(1:2:1000)=x(1:2:1000);- Hide quoted text - > > > > - Show quoted text - > > > Well, my understanding is that this is not exactly downsample-by-2 as > > y still has 1000 samples. This is the way for downsample-by-2 (your > > first lines of code) > > x = randn(1,1000); > > y = x(1:2:1000); &#4294967295; &#4294967295; &#4294967295;% y has 500 samples now. > > > You can also use a sine waveform to see your OP equation actually is > > correct.- Hide quoted text - > > > - Show quoted text - > > You are right Verictor &#4294967295;y = x(1:2:1000); &#4294967295;the OP equation is correct > for a sin signal as it is &#4294967295;one frequency, but it might not remain so > for a wide bandwidth signal. I should consider the case further ...- Hide quoted text - > > - Show quoted text -
The equation is correct as long as your downsampling didn't cause aliasing. Note that you were using randn(), downsample-by-2 will cause aliasing. I am sure you will notice this later. You can also use multiple frequencies too but just no aliasing.