Function compute_ar

Generates ar model with given noise in interval of time series either for constant parameters or generated by Matlab functions.

Contents

Input

Output

Copyrights

(C) All rights reserved.

The code may be used free of charge for non-commercial and educational purposes, the only requirement is that this text is preserved within the derivative work. For any other purpose you must contact the authors for permission. This code may not be redistributed without written permission from the authors.

ABOUT: This software implements our approach to detect changes in multi-variate time series

IMPORTANT: If you use this software you should cite the following in any resulting publication:
[1] Michal Staniszewski, Agnieszka Skorupa, Lukasz Boguszewicz, Maria Sokol and Andrzej Polanski. Quality Control Procedure Based on Partitioning of NMR Time Series.

function [x]=compute_ar(interval,noise,arcoeffs,matlab_flag)
    N = size(interval,1);
    if matlab_flag
        p = size(arcoeffs,2) - 1;
        randnoise = randn(1,N);
        x=zeros(1,N);
        for k=1:p
            x(k) = x(k) + noise * randnoise(1,k);
        end

        for k=(p+1):N
            for i=1:p
                x(k) = x(k)+arcoeffs(i+1)*x(k-p);
            end
            x(k) = x(k) + noise * randnoise(1,k);
        end
        x = x';
    else
        randnoise = randn(N,1);
        x = filter(1,arcoeffs,noise * randnoise(:,1));
    end
end
Error using compute_ar (line 29)
Not enough input arguments.