X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=CreaPhase.git;a=blobdiff_plain;f=octave_packages%2Fsignal-1.1.3%2Faryule.m;fp=octave_packages%2Fsignal-1.1.3%2Faryule.m;h=f9047d2c1d6fb67e8c421bd0115ec52eb262ecf1;hp=0000000000000000000000000000000000000000;hb=f5f7a74bd8a4900f0b797da6783be80e11a68d86;hpb=1705066eceaaea976f010f669ce8e972f3734b05 diff --git a/octave_packages/signal-1.1.3/aryule.m b/octave_packages/signal-1.1.3/aryule.m new file mode 100644 index 0000000..f9047d2 --- /dev/null +++ b/octave_packages/signal-1.1.3/aryule.m @@ -0,0 +1,61 @@ +## Copyright (C) 1999 Paul Kienzle +## Copyright (C) 2006 Peter Lanspeary +## +## This program is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free Software +## Foundation; either version 3 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, see . + +## usage: [a, v, k] = aryule (x, p) +## +## fits an AR (p)-model with Yule-Walker estimates. +## x = data vector to estimate +## a: AR coefficients +## v: variance of white noise +## k: reflection coeffients for use in lattice filter +## +## The power spectrum of the resulting filter can be plotted with +## pyulear(x, p), or you can plot it directly with ar_psd(a,v,...). +## +## See also: +## pyulear, power, freqz, impz -- for observing characteristics of the model +## arburg -- for alternative spectral estimators +## +## Example: Use example from arburg, but substitute aryule for arburg. +## +## Note: Orphanidis '85 claims lattice filters are more tolerant of +## truncation errors, which is why you might want to use them. However, +## lacking a lattice filter processor, I haven't tested that the lattice +## filter coefficients are reasonable. + +function [a, v, k] = aryule (x, p) + if ( nargin~=2 ) + print_usage; + elseif ( ~isvector(x) || length(x)<3 ) + error( 'aryule: arg 1 (x) must be vector of length >2' ); + elseif ( ~isscalar(p) || fix(p)~=p || p > length(x)-2 ) + error( 'aryule: arg 2 (p) must be an integer >0 and