]> Creatis software - CreaPhase.git/blob - octave_packages/tsa-4.2.4/rc2poly.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / tsa-4.2.4 / rc2poly.m
1 function [a,efinal] = rc2poly(RC,E);
2 % converts reflection coefficients into an AR-polynomial
3 % [a,efinal] = rc2poly(K)
4 %
5 % see also ACOVF ACORF AR2RC RC2AR DURLEV AC2POLY, POLY2RC, RC2POLY, RC2AC, AC2RC, POLY2AC
6
7
8 %       $Id: rc2poly.m 9609 2012-02-10 10:18:00Z schloegl $
9 %       Copyright (C) 1998-2002,2008,2012 by Alois Schloegl <alois.schloegl@ist.ac.at>
10 %       This is part of the TSA-toolbox. See also 
11 %       http://pub.ist.ac.at/~schloegl/matlab/tsa/
12 %       http://octave.sourceforge.net/
13 %       http://biosig.sourceforge.net/
14 %
15 %    This program is free software: you can redistribute it and/or modify
16 %    it under the terms of the GNU General Public License as published by
17 %    the Free Software Foundation, either version 3 of the License, or
18 %    (at your option) any later version.
19 %
20 %    This program is distributed in the hope that it will be useful,
21 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
22 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 %    GNU General Public License for more details.
24 %
25 %    You should have received a copy of the GNU General Public License
26 %    along with this program.  If not, see <http://www.gnu.org/licenses/>.
27
28
29 if nargout>1 && nargin<2
30    fprintf('Zero-lag autocorrelation, R0 not specified\n')
31    return; 
32 end;
33    
34 mfilename='RC2POLY';
35 if all(size(RC))>1,
36         fprintf(2,'Error %s: "K" must be a vector\n',mfilename);
37         return;
38 end;
39
40 if ~exist('rc2ar','file')
41         fprintf(2,'Error %s: RC2AR.M not found. \n Download TSA toolbox from http://www.dpmi.tu-graz.ac.at/~schloegl/matlab/tsa/\n',mfilename);
42         return;
43 end;
44
45 [AR,RC,PE] = rc2ar(RC(:).');
46
47 a=[1,-AR];
48 efinal=PE(length(PE))/PE(1);