# Correlation using fft and xcorr and plot both answers (Matlab) [closed]

I am trying to calculate autocorrelation using fft and xcorr and plot the grafhic with both cases.

autocorr_a=xcorr(signal_1,signal_1);
N1=length(signal_1);
autocorr_b=ifft( fft(signal_1,N1) .* conj(fft(signal_1,N1)));
x1=[0:(2*length(signal_1)-2)]'/(2*length(signal_1)-1);
plot(x1, autocorr_a, x1, autocorr_b)


What is wrong?

• Welcome to DSP.SE! Why are you asking "What is wrong?" there doesn't appear to be any information in your question as to what you think is wrong. Please edit your question to add this information. – Peter K. Nov 17 '15 at 13:15