File: SPcovXpc.html

package info (click to toggle)
libtsp 3r0-1
  • links: PTS
  • area: non-free
  • in suites: potato, woody
  • size: 5,096 kB
  • ctags: 1,798
  • sloc: ansic: 14,464; sh: 1,217; makefile: 182
file content (118 lines) | stat: -rw-r--r-- 3,483 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<HTML>
<HEAD>
<TITLE>TSP (libtsp/SP) - SPcovXpc</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFACD">
<H2>SPcovXpc</H2>
<HR>
<H4>Routine</H4>
<DL>
<DT>
double SPcovXpc (const float *Cov[], float pc[], int Np)
</DL>
<H4>Purpose</H4>
<DL>
<DT>
Find predictor coefficients using the covariance method
</DL>
<H4>Description</H4>
This procedure finds the predictor coefficients for a linear predictor which
minimizes the mean-square error using the covariance method.  Note that the
resulting predictor coefficients may give a non-minimum phase prediction
error filter.
<P>
Consider a linear predictor with Np coefficients,
<PRE>
          Np
  y(k) = SUM p(i) x(k-i) ,
         i=1
</PRE>
where x(k) is the input signal.  The prediction error is
<P>
<PRE>
  e(k) = x(k) - y(k) .
</PRE>
<P>
To minimize the mean-square prediction error, solve
<P>
<PRE>
  R p = r,
</PRE>
<P>
where R is a symmetric positive definite covariance matrix, p is a vector
of predictor coefficients and r is a vector of correlation values.  The
matrix R and and vector r are defined as follows
<PRE>
  R(i,j) = Cov(i,j) = E[x(k-i) x(k-j)],  for 1 &lt;= i,j &lt;= Np,
    r(i) = Cov(0,i) = E[x(k) x(k-i)],    for 1 &lt;= i &lt;= Np.
</PRE>
<P>
The solution is found using a Cholesky decomposition of the matrix R.  The
resulting mean-square prediction error can be expressed as
<P>
<PRE>
  perr = Ex - 2 p'r + p'R p
       = E0 - p'r ,
</PRE>
<P>
where Ex is the mean-square value of the input signal,
<P>
<PRE>
  Ex = Cov(0,0) = E[x(k)^2].
</PRE>
<P>
The expectation operator E[.] is often replaced by a sum over k over a finite
interval.  Minimization of the prediction error over this interval defines
the so-called covariance method for determining the linear prediction
coefficients.
<P>
If the coefficient matrix is numerically not positive definite, or if the
prediction error energy becomes negative at some stage in the calculation,
the remaining predictor coefficients are set to zero.  This is equivalent to
truncating the coefficient matrix at the point at which it is positive
definite.
<P>
Predictor coefficients are usually expressed algebraically as vectors with
1-offset indexing.  The correspondence to the 0-offset C-arrays is as
follows.
<PRE>
  p(1) &lt;==&gt; pc[0]       predictor coefficient corresponding to lag 1
  p(i) &lt;==&gt; pc[i-1]     1 &lt;= i &lt; Np
</PRE>
<H4>Parameters</H4>
<DL>
<DT>
&lt;-  double SPcovXpc
<DD>
Resultant prediction error energy
<DT>
 -&gt; const float *Cov[]
<DD>
Cov is an array of pointers to the rows of an Np+1 by Np+1 symmetric
positive definite correlation matrix.  Only the lower triangular portion
of Cov is accessed.  Note that with ANSI C, if the actual parameter
is not declared to have the const attribute, an explicit cast to
(const float **) is required.
<DT>
&lt;-  float pc[]
<DD>
Vector of predictor coefficients (Np values).  These are the coefficients
of the predictor filter, with pc[0] being the predictor coefficient
corresponding to lag 1, and pc[Np-1] corresponding to lag Np.
<DT>
 -&gt; int Np
<DD>
Number of predictor coefficients
</DL>
<H4>Author / revision</H4>
P. Kabal  Copyright (C) 1996
/ Revision 1.7  1996/04/17
<H4>See Also</H4>
<A HREF="SPcorXpc.html">SPcorXpc</A>,
<A HREF="SPcovMXpc.html">SPcovMXpc</A>,
<A HREF="SPcovar.html">SPcovar</A>
<P>
<HR>
Main Index <A HREF="../libtsp.html">libtsp</A>
</BODY>
</HTML>