I’d like to autocorrelate some data but it has some missing values, is there a quick way to do this in matlab? xcorr returns an array of NaN if any of the input is NaN.
e.g.
data = [1 2 3 4 NaN 2 3 4 1 2 3 4];
xc = xcorr(data, 'biased');
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
With some insight from Nzbuu, the following works:
It is necessary to insert zeros after scaling the data, not before, as otherwise this will affect the value of mu and std used within xcorr. It is better to do this, than simply working out xcorr directly, as the fft approach used within xcorr is much faster for big datasets.