autocov is initialized NaN with the original order and then only loop up to updted order compatible with sample size.
parent
15ab85788c
commit
d56bba724c
|
@ -55,8 +55,9 @@ function autocov = nanautocovariance(data,order)
|
|||
|
||||
n = size(data,2);
|
||||
missing = isanynan(data);
|
||||
autocov = nan(n, n, order);
|
||||
order = min(size(data,1)-2,order);
|
||||
autocov = zeros(n, n, order);
|
||||
autocov(:, :, 1:order)=0;
|
||||
|
||||
for lag=1:order
|
||||
if missing
|
||||
|
|
Loading…
Reference in New Issue