On 21 July, 16:08, Verictor <stehu...@gmail.com> wrote:
> On Jul 21, 8:32�am, Thierry <thierrybi...@googlemail.com> wrote:
>
>
>
>
>
> > On 20 July, 17:48, Verictor <stehu...@gmail.com> wrote:
>
> > > On Jul 20, 7:10�am, Thierry <thierrybi...@googlemail.com> wrote:
>
> > > > On 19 July, 16:09, Verictor <stehu...@gmail.com> wrote:
>
> > > > > On Jul 18, 7:15�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�pm, Thierry <thierrybi...@googlemail.com> wrote:
>
> > > > > > > > > Hi Guys,
> > > > > > > > > forgive me but it has been 10 years since i took a course insignal
> > > > > > > > > processing. i am doing some simulations and i need the expression of
> > > > > > > > > theautocorrelation(Rx') of asignalafter downsampling using the
> > > > > > > > >autocorrelation(Rx) of the unsampledsignal.
>
> > > > > > > > > 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.
>
> > > > > > > > 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 downsampleautocorrelation.
>
> > > > > > > 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- 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.- Hide quoted text -
>
> > > > > - Show quoted text -
>
> > > > You are right Verictor �y = x(1:2:1000); �the OP equation is correct
> > > > for a sinsignalas it is �one frequency, but it might not remain so
> > > > for a wide bandwidthsignal. 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.- Hide quoted text -
>
> > > - Show quoted text -
>
> > but i can;t verify this using matlab. below is my script program.
> > OutCorr is theautocorrelationof the non-downsampledfilter ouput.
> > outcorr_s is that of thedownsampledsignal. the esrults of the script
> > execution is:
> > OutCorr(1:10)=
> > [-0.0042,-0.0158,0.0445,0.2343,0.2637,-0.1311,-0.6974,-1.0781,-1.0527,-0.69��12]
> > OutCorr_S(1:4)=[-0.0085,0.1179,0.0663,-0.6025,-0.7993]
> > max(OutCorr)=91.5355
> > max(OutCorr_S)=88.9495
> > any help please, i am sure i am missing something
>
> > % script
> > function [OutCorr,OutCorr_S]=corrSamp()
> > N=512;
> > Scale=10;
> > In=Scale*randn(N,1);
> > % daubechies 4 filter
> > Flt='db2';
> > [La,Ha]=wfilters(Flt);
> > % sampling ratio
> > Out=conv(In,La);
> > Sampling=2;
> > Out_S=Out(1:Sampling:length(Out));
> > OutCorr=xcorr(Out,Out)/length(Out);
> > OutCorr_S=xcorr(Out_S,Out_S)/length(Out_S);- Hide quoted text -
>
> > - Show quoted text -
>
> I haven't used wavelet filter before so I can't comment on the filter
> you used. I don't have the toolbox either but you can check your
> filter response to see how good it is. Here instead, I give you a
> simple script to see how it works. You can then play around your
> filter.
>
> % simple script starts
> n = 512;
> scale = 10;
> in = scale * randn(n,1); � � �% since you still prefer randn()
> b = fir1(128,0.2); � � � � � � � % check how the frequency response
> looks like
> out = filter(b,1, in); � � � � � �% pass input through the anti-
> aliasing filter
> outcorr= xcorr(in); � � � � � � % in is a vector
> outcorr_s = xcorr(in(1:2:end)); % downsample sequency auto-correlation
> max(outcorr); � � � � � � � � � �% I got 1.7197e+004
> max(outcorr_s); � � � � � � � �% I got 8.5983e+003
> plot(outcorr);
> hold on
> plot(outcorr_s, 'r') � � � � � � �% clearly you can see what happened
> according to the equation.- Hide quoted text -
>
> - Show quoted text -
re. the autocorrelation expression above. i think we need to divide by
the number of signal samples since it is an estimation