i beginer of matlab. have 1 question why correlation out_cor(m) below not close zero? there wrong understanding: random noise signal has no correlation determined signal, if n large. hlep. regards jeff
n=1024*4; f0=1e3; fs=64*f0; n=1:n;x=0.01*randn(1,n); y=sin(2*pi*f0*n/fs); figure(1) plot(n,x,n,y); out_cor=xcorr(x-mean(x),y); figure(2) plot(out_cor);
the output of xcorr no scaling options give correlation sequence isn't normalized number of samples. can see if plot this:
xcorr(y, y)
your vector y 0 mean, maximum value of auto correlation sequence should equal variance of y. in case, need divide correlation sequence n-1 see correctly scaled values.
if want see how 2 signals correlate 1 other need frame of reference. 1 way compare cross correlation against autocorrelation values of each individual signal. better way measure correlation coefficients normalized values of sequence ranging -1 1. can xcorr passing additional argument:
xcorr(x, y, 'coeff')
a coefficient of 1 perfect match, -1 perfect inverse (correlating x -x this), , 0 means signals uncorrelated.
Comments
Post a Comment