diff options
author | shamikam | 2017-11-07 15:59:48 +0530 |
---|---|---|
committer | shamikam | 2017-11-07 15:59:48 +0530 |
commit | c0c0582462720ed597b00e116506570577614e89 (patch) | |
tree | 31dedd23698e5357b19c810b7d7a8464100ef44a /macros/arburg.sci~ | |
download | FOSSEE-Signal-Processing-Toolbox-c0c0582462720ed597b00e116506570577614e89.tar.gz FOSSEE-Signal-Processing-Toolbox-c0c0582462720ed597b00e116506570577614e89.tar.bz2 FOSSEE-Signal-Processing-Toolbox-c0c0582462720ed597b00e116506570577614e89.zip |
initial commit
Diffstat (limited to 'macros/arburg.sci~')
-rw-r--r-- | macros/arburg.sci~ | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/macros/arburg.sci~ b/macros/arburg.sci~ new file mode 100644 index 0000000..1ca6e01 --- /dev/null +++ b/macros/arburg.sci~ @@ -0,0 +1,55 @@ +function varargout = arburg( x, poles, criterion ) +//This function calculates coefficients of an autoregressive (AR) model of complex data. +//Calling Sequence +//a = arburg(x, poles) +//a = arburg(x, poles, criterion) +//[a, v] = arburg(...) +//[a, v, k] = arburg(...) +//Parameters +//x: vector of real or complex numbers, of length > 2 +//poles: positive integer value < length(x) - 2 +//criterion: string value, takes in "AKICc", "KIC", "AICc", "AIC" and "FPE", default it not using a model-selection criterion +//a, v, k: Output variables +//Description +//This is an Octave function. +//This function calculates coefficients of an autoregressive (AR) model of complex data x using the whitening lattice-filter method of Burg. +//The first argument is the data sampled. The second argument is the number of poles in the model (or limit in case a criterion is supplied). +//The third parameter takes in the criterion to limit the number of poles. The acceptable values are "AIC", "AKICc", "KIC", "AICc" which are based on information theory. +//Output variable a is a list of P+1 autoregression coefficients. +//Output variable v is the mean square of residual noise from the whitening operation of the Burg lattice filter. +//Output variable k corresponds to the reflection coefficients defining the lattice-filter embodiment of the model. +//Examples +//arburg([1,2,3,4,5],2) +//ans = +// 1.00000 -1.86391 0.95710 + +funcprot(0); +rhs = argn(2) +lhs = argn(1) +if(lhs>3) +error("Wrong number of output arguments.") +elseif(rhs<2) +error("Wrong number of input arguments.") +end + + select(lhs) + case 1 then + if(rhs==2) + a = callOctave("arburg",x,poles) + elseif(rhs==3) + a = callOctave("arburg",x,poles,criterion) + end + case 2 then + if(rhs==2) + [a,v] = callOctave("arburg",x,poles) + elseif(rhs==3) + [a,v] = callOctave("arburg",x,poles,criterion) + end + case 3 then + if(rhs==2) + [a,v,k] = callOctave("arburg",x,poles) + elseif(rhs==3) + [a,v,k] = callOctave("arburg",x,poles,criterion) + end + end +endfunction |