XCORR returns NaNs on interpolated data
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Artem Smirnov
am 23 Nov. 2017
Beantwortet: Walter Roberson
am 24 Nov. 2017
Hello! I have a vector A of dimension 12*1 with monthly values of temperature, and a vector B of dimension 365*1 with daily values of a physical variable. I need to calculate cross correlation between them. I try to interpolate A using interp1. However, after that when I do xcorr, it gives me an array of NaNs. What is the reason of that? Here's what I do:
AA=interp1(1:12,A, 1:365);
C=xcorr(AA,B,'coeff');
And xcorr(AA,AA) also gives me array of NaNs. How can I fix it?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 24 Nov. 2017
When you ask interp1 to interpolate outside the original range of x, then the default value returned is NaN.
You could try
AA = interp1(1:12, A, linspace(1,12,365));
0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!