how to plot auto correlation and cross correlation function in a single figure?
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
while plotting the ACf and CCF i didnt get the negative side of Auto correlation fucntion. I am getting only positive side only.
x=sin(2*pi*f/fs*t);
y=cos(2*pi*f/fs*t);
[ACF,Lags,Bounds] = autocorr(x,nLags,nSTDs);
[XCF,Lag,Bound] = crosscorr(x,y,nLags,nSTDs);
plot(Lags,ACF);
hold on
plot(Lag,XCF);
grid on
i getting output like given figure. Help me to get the negative side of the ACF.
2 comentarios
Adam
el 20 de En. de 2017
Did you read the help for autocorr?
'The elements of acf correspond to lags 0,1,2,...,numLags. The first element, which corresponds to lag 0, is unity (i.e., acf(1) = 1).'
Respuestas (1)
David J. Mack
el 20 de En. de 2017
Editada: David J. Mack
el 20 de En. de 2017
The negative autocorrelation is the same as the positive as you use the same signal for the correlation. So if you want to pretend there is a negative part:
plot([-Lags(end:-1:1) Lags],[ACF(end:-1:1) ACF]);
Greetings, David
0 comentarios
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!