summaryrefslogtreecommitdiff
path: root/macros/arcov.sci~
blob: 179e34a61258dbfa61ba47752dd04472b0180f49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function [ar_coeff, var_est] = arcov(data_in, order)
//arcov Autoregressive all-pole model parameters — covariance method
//Calling Syntax
//a = arcov(x,p)
//[a,e] = arcov(x,p)
//a, contains normalized estimates of the AR system parameters, A(z), in descending powers of z.
//e variance estimate of the white noise input to the AR model
// x is the input signal
// p is the order of the auto regressive model
    
    checkNArgin(2,2, argn(2));
    if type(data_in)==10 then
        error("Input should not be of type char");
    end
    method = 'covariance';
    [ar_coeff, var_est, msg] = arParEst(data_in, order, method);
    if ~isempty(msg) then
        error(msg);
    end
    
    
endfunction

function checkNArgin(min_argin, max_argin, num_of_argin)
    if num_of_argin < min_argin then
        error('Not enough input arguments')
    end
    
    if num_of_argin > max_argin then
        error('Too many input arguments')
    end
        
endfunction