~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to man/fr/signal/corr.xml

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
 
2
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
 
3
<MAN>
 
4
  <LANGUAGE>eng</LANGUAGE>
 
5
  <TITLE>corr</TITLE>
 
6
  <TYPE>Scilab Function</TYPE>
 
7
  <DATE>April 1993</DATE>
 
8
  <SHORT_DESCRIPTION name="corr"> correlation, covariance</SHORT_DESCRIPTION>
 
9
  <CALLING_SEQUENCE>
 
10
    <CALLING_SEQUENCE_ITEM>[cov,Mean]=corr(x,[y],nlags)  </CALLING_SEQUENCE_ITEM>
 
11
    <CALLING_SEQUENCE_ITEM>[cov,Mean]=corr('fft',xmacro,[ymacro],n,sect)  </CALLING_SEQUENCE_ITEM>
 
12
    <CALLING_SEQUENCE_ITEM>  </CALLING_SEQUENCE_ITEM>
 
13
    <CALLING_SEQUENCE_ITEM>[w,xu]=corr('updt',x1,[y1],w0)  </CALLING_SEQUENCE_ITEM>
 
14
    <CALLING_SEQUENCE_ITEM>[w,xu]=corr('updt',x2,[y2],w,xu)  </CALLING_SEQUENCE_ITEM>
 
15
    <CALLING_SEQUENCE_ITEM> ...  </CALLING_SEQUENCE_ITEM>
 
16
    <CALLING_SEQUENCE_ITEM>[wk]=corr('updt',xk,[yk],w,xu)  </CALLING_SEQUENCE_ITEM>
 
17
  </CALLING_SEQUENCE>
 
18
  <PARAM>
 
19
    <PARAM_INDENT>
 
20
      <PARAM_ITEM>
 
21
        <PARAM_NAME>x</PARAM_NAME>
 
22
        <PARAM_DESCRIPTION>
 
23
          <SP>: a real vector</SP>
 
24
        </PARAM_DESCRIPTION>
 
25
      </PARAM_ITEM>
 
26
      <PARAM_ITEM>
 
27
        <PARAM_NAME>y</PARAM_NAME>
 
28
        <PARAM_DESCRIPTION>
 
29
          <SP>: a real vector, default value x.</SP>
 
30
        </PARAM_DESCRIPTION>
 
31
      </PARAM_ITEM>
 
32
      <PARAM_ITEM>
 
33
        <PARAM_NAME>nlags</PARAM_NAME>
 
34
        <PARAM_DESCRIPTION>
 
35
          <SP>: integer, number of correlation coefficients desired.</SP>
 
36
        </PARAM_DESCRIPTION>
 
37
      </PARAM_ITEM>
 
38
      <PARAM_ITEM>
 
39
        <PARAM_NAME>xmacro</PARAM_NAME>
 
40
        <PARAM_DESCRIPTION>
 
41
          <SP>: a scilab external (see below).</SP>
 
42
        </PARAM_DESCRIPTION>
 
43
      </PARAM_ITEM>
 
44
      <PARAM_ITEM>
 
45
        <PARAM_NAME>ymacro</PARAM_NAME>
 
46
        <PARAM_DESCRIPTION>
 
47
          <SP>: a scilab external (see below), default value xmacro</SP>
 
48
        </PARAM_DESCRIPTION>
 
49
      </PARAM_ITEM>
 
50
      <PARAM_ITEM>
 
51
        <PARAM_NAME>n</PARAM_NAME>
 
52
        <PARAM_DESCRIPTION>
 
53
          <SP>: an integer, total size of the sequence (see below).</SP>
 
54
        </PARAM_DESCRIPTION>
 
55
      </PARAM_ITEM>
 
56
      <PARAM_ITEM>
 
57
        <PARAM_NAME>sect</PARAM_NAME>
 
58
        <PARAM_DESCRIPTION>
 
59
          <SP>: size of sections of the sequence (see below).</SP>
 
60
        </PARAM_DESCRIPTION>
 
61
      </PARAM_ITEM>
 
62
      <PARAM_ITEM>
 
63
        <PARAM_NAME>xi</PARAM_NAME>
 
64
        <PARAM_DESCRIPTION>
 
65
          <SP>: a real vector</SP>
 
66
        </PARAM_DESCRIPTION>
 
67
      </PARAM_ITEM>
 
68
      <PARAM_ITEM>
 
69
        <PARAM_NAME>yi</PARAM_NAME>
 
70
        <PARAM_DESCRIPTION>
 
71
          <SP>: a real vector,default value xi.</SP>
 
72
        </PARAM_DESCRIPTION>
 
73
      </PARAM_ITEM>
 
74
      <PARAM_ITEM>
 
75
        <PARAM_NAME>cov</PARAM_NAME>
 
76
        <PARAM_DESCRIPTION>
 
77
          <SP>: real vector, the correlation coefficients</SP>
 
78
        </PARAM_DESCRIPTION>
 
79
      </PARAM_ITEM>
 
80
      <PARAM_ITEM>
 
81
        <PARAM_NAME>Mean</PARAM_NAME>
 
82
        <PARAM_DESCRIPTION>
 
83
          <SP>: real number or vector,  the mean of x and if given y</SP>
 
84
        </PARAM_DESCRIPTION>
 
85
      </PARAM_ITEM>
 
86
    </PARAM_INDENT>
 
87
  </PARAM>
 
88
  <DESCRIPTION>
 
89
    <P>
 
90
    Computes
 
91
  </P>
 
92
    <VERBATIM>
 
93
<![CDATA[
 
94
                n - m 
 
95
                 ====
 
96
                 \                                                 1
 
97
        cov(m) =  >        (x(k)  - xmean) (y(m+k)      - ymean) * ---
 
98
                 /                                                  n
 
99
                 ====
 
100
                 k = 1
 
101
   ]]>
 
102
    </VERBATIM>
 
103
    <P>
 
104
    for   m=0,..,<VERB>nlag-1</VERB> and two vectors <VERB>x=[x(1),..,x(n)]</VERB>
 
105
     <VERB>y=[y(1),..,y(n)]</VERB>
 
106
  </P>
 
107
    <P>
 
108
    Note that if x and y sequences are differents corr(x,y,...) is
 
109
    different with corr(y,x,...)
 
110
  </P>
 
111
    <DESCRIPTION_INDENT>
 
112
      <DESCRIPTION_ITEM label="Short sequences">
 
113
        <SP><VERB>[cov,Mean]=corr(x,[y],nlags)</VERB> returns the first nlags
 
114
    correlation coefficients and Mean = <VERB>mean(x)</VERB>
 
115
    (mean of <VERB>[x,y]</VERB> if <VERB>y</VERB> is an argument).
 
116
    The sequence <VERB>x</VERB> (resp. <VERB>y</VERB>) is assumed real, and <VERB>x</VERB> 
 
117
    and <VERB>y</VERB> are of same dimension n.</SP>
 
118
      </DESCRIPTION_ITEM>
 
119
      <DESCRIPTION_ITEM label="Long sequences">
 
120
        <SP><VERB>[cov,Mean]=corr('fft',xmacro,[ymacro],n,sect)</VERB> Here <VERB>xmacro</VERB> is either</SP>
 
121
        <DESCRIPTION_INDENT>
 
122
          <DESCRIPTION_ITEM>
 
123
            <P> 
 
124
        a function of type <VERB>[xx]=xmacro(sect,istart)</VERB> which
 
125
        returns a vector <VERB>xx</VERB> of dimension
 
126
        <VERB>nsect</VERB> containing the part of the sequence with
 
127
        indices from <VERB>istart</VERB> to
 
128
        <VERB>istart+sect-1</VERB>.</P>
 
129
          </DESCRIPTION_ITEM>
 
130
          <DESCRIPTION_ITEM>
 
131
            <P>
 
132
        a fortran subroutine or C procedure which performs the same
 
133
        calculation. (See the source code of <VERB>dgetx</VERB> for an
 
134
        example). <VERB>n</VERB> = total size of the
 
135
        sequence. <VERB>sect</VERB> = size of sections of the
 
136
        sequence. <VERB>sect</VERB> must be a power of
 
137
        2. <VERB>cov</VERB> has dimension
 
138
        <VERB>sect</VERB>. Calculation is performed by FFT.</P>
 
139
          </DESCRIPTION_ITEM>
 
140
        </DESCRIPTION_INDENT>
 
141
      </DESCRIPTION_ITEM>
 
142
      <DESCRIPTION_ITEM label="Updating method">
 
143
        <VERBATIM>
 
144
<![CDATA[
 
145
    [w,xu]=corr('updt',x1,[y1],w0)
 
146
    [w,xu]=corr('updt',x2,[y2],w,xu)
 
147
     ...
 
148
    wk=corr('updt',xk,[yk],w,xu)
 
149
    ]]>
 
150
        </VERBATIM>
 
151
        <P>
 
152
    With this calling sequence the calculation is updated at each
 
153
    call to <VERB>corr</VERB>.</P>
 
154
        <VERBATIM>
 
155
<![CDATA[
 
156
    w0 = 0*ones(1,2*nlags);
 
157
    nlags = power of 2.
 
158
    ]]>
 
159
        </VERBATIM>
 
160
        <P><VERB>x1,x2,...</VERB> are parts of <VERB>x</VERB> such that
 
161
    <VERB>x=[x1,x2,...]</VERB> and sizes of <VERB>xi</VERB> a power of
 
162
    2.  To get <VERB>nlags</VERB> coefficients a final fft must be
 
163
    performed <VERB>c=fft(w,1)/n</VERB>; <VERB>cov=c(1nlags)</VERB>
 
164
    (<VERB>n</VERB> is the size of <VERB>x (y)</VERB>).  Caution: this
 
165
    calling sequence assumes that <VERB>xmean = ymean = 0</VERB>.</P>
 
166
      </DESCRIPTION_ITEM>
 
167
    </DESCRIPTION_INDENT>
 
168
  </DESCRIPTION>
 
169
  <EXAMPLE>
 
170
<![CDATA[
 
171
x=%pi/10:%pi/10:102.4*%pi;
 
172
rand('seed');rand('normal');
 
173
y=[.8*sin(x)+.8*sin(2*x)+rand(x);.8*sin(x)+.8*sin(1.99*x)+rand(x)];
 
174
c=[];
 
175
for j=1:2,for k=1:2,c=[c;corr(y(k,:),y(j,:),64)];end;end;
 
176
c=matrix(c,2,128);cov=[];
 
177
for j=1:64,cov=[cov;c(:,(j-1)*2+1:2*j)];end;
 
178
rand('unif')
 
179
//
 
180
rand('normal');x=rand(1,256);y=-x;
 
181
deff('[z]=xx(inc,is)','z=x(is:is+inc-1)');
 
182
deff('[z]=yy(inc,is)','z=y(is:is+inc-1)');
 
183
[c,mxy]=corr(x,y,32);
 
184
x=x-mxy(1)*ones(x);y=y-mxy(2)*ones(y);  //centring
 
185
c1=corr(x,y,32);c2=corr(x,32);
 
186
norm(c1+c2,1)
 
187
[c3,m3]=corr('fft',xx,yy,256,32);
 
188
norm(c1-c3,1)
 
189
[c4,m4]=corr('fft',xx,256,32);
 
190
norm(m3,1),norm(m4,1)
 
191
norm(c3-c1,1),norm(c4-c2,1)
 
192
x1=x(1:128);x2=x(129:256);
 
193
y1=y(1:128);y2=y(129:256);
 
194
w0=0*ones(1:64);   //32 coeffs
 
195
[w1,xu]=corr('u',x1,y1,w0);w2=corr('u',x2,y2,w1,xu);
 
196
zz=real(fft(w2,1))/256;c5=zz(1:32);
 
197
norm(c5-c1,1)
 
198
[w1,xu]=corr('u',x1,w0);w2=corr('u',x2,w1,xu);
 
199
zz=real(fft(w2,1))/256;c6=zz(1:32);
 
200
norm(c6-c2,1)
 
201
rand('unif')
 
202
// test for Fortran or C external 
 
203
//
 
204
deff('[y]=xmacro(sec,ist)','y=sin(ist:(ist+sec-1))');
 
205
x=xmacro(100,1);
 
206
[cc1,mm1]=corr(x,2^3);
 
207
[cc,mm]=corr('fft',xmacro,100,2^3);
 
208
[cc2,mm2]=corr('fft','corexx',100,2^3);
 
209
[maxi(abs(cc-cc1)),maxi(abs(mm-mm1)),maxi(abs(cc-cc2)),maxi(abs(mm-mm2))]
 
210
 
 
211
deff('[y]=ymacro(sec,ist)','y=cos(ist:(ist+sec-1))');
 
212
y=ymacro(100,1);
 
213
[cc1,mm1]=corr(x,y,2^3);
 
214
[cc,mm]=corr('fft',xmacro,ymacro,100,2^3);
 
215
[cc2,mm2]=corr('fft','corexx','corexy',100,2^3);
 
216
[maxi(abs(cc-cc1)),maxi(abs(mm-mm1)),maxi(abs(cc-cc2)),maxi(abs(mm-mm2))]
 
217
 
 
218
 ]]>
 
219
  </EXAMPLE>
 
220
  <SEE_ALSO>
 
221
    <SEE_ALSO_ITEM>
 
222
      <LINK>fft</LINK>
 
223
    </SEE_ALSO_ITEM>
 
224
  </SEE_ALSO>
 
225
</MAN>