# how to plot auto correlation and cross correlation function in a single figure?

조회 수: 5(최근 30일)
vinod kumar govindu 2017년 1월 20일
편집: David J. Mack 2017년 1월 20일
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표시숨기기 이전 댓글 수: 1
vinod kumar govindu 2017년 1월 20일
what we have to do for getting response at negative lags also? I am new to the matlab and dsp.

댓글을 달려면 로그인하십시오.

### 답변(1개)

David J. Mack 2017년 1월 20일
편집: David J. Mack 2017년 1월 20일
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

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!