~ubuntu-branches/ubuntu/raring/scilab/raring-proposed

« back to all changes in this revision

Viewing changes to modules/signal_processing/help/en_US/filters/wiener.xml

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-08-30 14:42:38 UTC
  • mfrom: (1.4.7)
  • Revision ID: package-import@ubuntu.com-20120830144238-c1y2og7dbm7m9nig
Tags: 5.4.0-beta-3-1~exp1
* New upstream release
* Update the scirenderer dep
* Get ride of libjhdf5-java dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  version="5.0-subset Scilab" xml:lang="en" xml:id="wiener">
 
3
    <refnamediv>
 
4
        <refname>wiener</refname>
 
5
        <refpurpose>  Wiener estimate</refpurpose>
 
6
    </refnamediv>
 
7
    <refsynopsisdiv>
 
8
        <title>Calling Sequence</title>
 
9
        <synopsis>[xs,ps,xf,pf]=wiener(y,x0,p0,f,g,h,q,r)</synopsis>
 
10
    </refsynopsisdiv>
 
11
    <refsection>
 
12
        <title>Arguments</title>
 
13
        <variablelist>
 
14
            <varlistentry>
 
15
                <term>f, g, h</term>
 
16
                <listitem>
 
17
                    <para>
 
18
                        system matrices in the interval <literal>[t0,tf]</literal>
 
19
                    </para>
 
20
                    <variablelist>
 
21
                        <varlistentry>
 
22
                            <term>f</term>
 
23
                            <listitem>
 
24
                                <para>
 
25
                                    =<literal>[f0,f1,...,ff]</literal>, and <literal>fk</literal> is a nxn matrix
 
26
                                </para>
 
27
                            </listitem>
 
28
                        </varlistentry>
 
29
                        <varlistentry>
 
30
                            <term>g</term>
 
31
                            <listitem>
 
32
                                <para>
 
33
                                    =<literal>[g0,g1,...,gf]</literal>, and <literal>gk</literal> is a nxn matrix
 
34
                                </para>
 
35
                            </listitem>
 
36
                        </varlistentry>
 
37
                        <varlistentry>
 
38
                            <term>h</term>
 
39
                            <listitem>
 
40
                                <para>
 
41
                                    =<literal>[h0,h1,...,hf]</literal>, and <literal>hk</literal> is a mxn matrix
 
42
                                </para>
 
43
                            </listitem>
 
44
                        </varlistentry>
 
45
                    </variablelist>
 
46
                </listitem>
 
47
            </varlistentry>
 
48
            <varlistentry>
 
49
                <term>q, r</term>
 
50
                <listitem>
 
51
                    <para>covariance matrices of dynamics and observation noise</para>
 
52
                    <variablelist>
 
53
                        <varlistentry>
 
54
                            <term>q</term>
 
55
                            <listitem>
 
56
                                <para>
 
57
                                    =<literal>[q0,q1,...,qf]</literal>, and <literal>qk</literal> is a nxn matrix
 
58
                                </para>
 
59
                            </listitem>
 
60
                        </varlistentry>
 
61
                        <varlistentry>
 
62
                            <term>r</term>
 
63
                            <listitem>
 
64
                                <para>
 
65
                                    =<literal>[r0,r1,...,rf]</literal>, and <literal>gk</literal> is a mxm matrix
 
66
                                </para>
 
67
                            </listitem>
 
68
                        </varlistentry>
 
69
                    </variablelist>
 
70
                </listitem>
 
71
            </varlistentry>
 
72
            <varlistentry>
 
73
                <term>x0, p0</term>
 
74
                <listitem>
 
75
                    <para>initial state estimate and error variance</para>
 
76
                </listitem>
 
77
            </varlistentry>
 
78
            <varlistentry>
 
79
                <term>y</term>
 
80
                <listitem>
 
81
                    <para>
 
82
                        observations in the interval <literal>[t0,tf]</literal>. <literal>y=[y0,y1,...,yf]</literal>, and <literal>yk</literal> is a column m-vector
 
83
                    </para>
 
84
                </listitem>
 
85
            </varlistentry>
 
86
            <varlistentry>
 
87
                <term>xs</term>
 
88
                <listitem>
 
89
                    <para>
 
90
                        Smoothed state estimate <literal>xs= [xs0,xs1,...,xsf]</literal>, and <literal>xsk</literal> is a column n-vector
 
91
                    </para>
 
92
                </listitem>
 
93
            </varlistentry>
 
94
            <varlistentry>
 
95
                <term>ps</term>
 
96
                <listitem>
 
97
                    <para>
 
98
                        Error covariance of smoothed estimate <literal>ps=[p0,p1,...,pf]</literal>, and <literal>pk</literal> is a nxn matrix
 
99
                    </para>
 
100
                </listitem>
 
101
            </varlistentry>
 
102
            <varlistentry>
 
103
                <term>xf</term>
 
104
                <listitem>
 
105
                    <para>
 
106
                        Filtered state estimate <literal>xf= [xf0,xf1,...,xff]</literal>, and <literal>xfk</literal> is a column n-vector
 
107
                    </para>
 
108
                </listitem>
 
109
            </varlistentry>
 
110
            <varlistentry>
 
111
                <term>pf</term>
 
112
                <listitem>
 
113
                    <para>
 
114
                        Error covariance of filtered estimate <literal>pf=[p0,p1,...,pf]</literal>, and <literal>pk</literal> is a nxn matrix
 
115
                    </para>
 
116
                </listitem>
 
117
            </varlistentry>
 
118
        </variablelist>
 
119
    </refsection>
 
120
    <refsection>
 
121
        <title>Description</title>
 
122
        <para>
 
123
            function which gives the Wiener estimate using
 
124
            the forward-backward Kalman filter formulation
 
125
        </para>
 
126
    </refsection>
 
127
    <refsection>
 
128
        <title>Sample</title>
 
129
        <scilab:image>
 
130
            m0=[10 10]';
 
131
            p0=[100 0;0 100];
 
132
            f2=[1.1 50.1;0 0.8];
 
133
            g=[1 0;0 1];
 
134
            h=[1 0;0 1];
 
135
            [hi,hj]=size(h);
 
136
            q=[.01 0;0 0.01];
 
137
            r=20*eye(2,2);
 
138
            rand("seed",66);
 
139
            rand("normal");
 
140
            p0c=chol(p0);
 
141
            x0=m0+p0c'*rand(ones(m0));
 
142
            y=h*x0+chol(r)'*rand(ones(1:hi))';
 
143
            yt=y;
 
144
            x=x0;
 
145
            ft=[f2];
 
146
            gt=[g];
 
147
            ht=[h];
 
148
            qt=[q];
 
149
            rt=[r];
 
150
            n=10;
 
151
            for k=1:n
 
152
            [x1,y]=system(x0,f2,g,h,q,r);
 
153
            x=[x x1];
 
154
            yt=[yt y];
 
155
            x0=x1;
 
156
            ft=[ft f2];
 
157
            gt=[gt g];
 
158
            ht=[ht h];
 
159
            qt=[qt q];
 
160
            rt=[rt r];
 
161
            end
 
162
            [xs,ps,xf,pf]=wiener(yt,m0,p0,ft,gt,ht,qt,rt);
 
163
            a=min([x(1,:)-2*sqrt(ps(1,1:2:2*(n+1))),xf(1,:),xs(1,:)]);
 
164
            b=max([x(1,:)+2*sqrt(ps(1,1:2:2*(n+1))),xf(1,:),xs(1,:)]);
 
165
            c=min([x(2,:)-2*sqrt(ps(2,2:2:2*(n+1))),xf(2,:),xs(2,:)]);
 
166
            d=max([x(2,:)+2*sqrt(ps(2,2:2:2*(n+1))),xf(2,:),xs(2,:)]);
 
167
            xmargin=max([abs(a),abs(b)]);
 
168
            ymargin=max([abs(c),abs(d)]);
 
169
            a=-0.1*xmargin+a;
 
170
            b=.1*xmargin+b;
 
171
            c=-0.1*ymargin+c;
 
172
            d=.1*ymargin+d;
 
173
            scf();
 
174
            plot([a a b],[d c c]);
 
175
            plot2d(x(1,:)',x(2,:)',[2],"000")
 
176
            plot2d(xf(1,:)',xf(2,:)',[2],"000")
 
177
            plot2d(xs(1,:)',xs(2,:)',[2],"000")
 
178
            plot2d(xs(1,:)',xs(2,:)',[-2],"000")
 
179
            plot2d(xf(1,:)',xf(2,:)',[-3],"000")
 
180
            plot2d(x(1,:)',x(2,:)',[-4],"000")
 
181
        </scilab:image>
 
182
    </refsection>
 
183
    <refsection>
 
184
        <title>Examples</title>
 
185
        <programlisting role="example"><![CDATA[ 
 
186
// initialize state statistics (mean and er. variance)
 
187
m0=[10 10]';
 
188
p0=[100 0;0 100];
 
189
// create system
 
190
f2=[1.1 50.1;0 0.8];
 
191
g=[1 0;0 1];
 
192
h=[1 0;0 1];
 
193
[hi,hj]=size(h);
 
194
// noise statistics
 
195
q=[.01 0;0 0.01];
 
196
r=20*eye(2,2);
 
197
// initialize system process
 
198
rand("seed",66);
 
199
rand("normal");
 
200
p0c=chol(p0);
 
201
x0=m0+p0c'*rand(ones(m0));
 
202
y=h*x0+chol(r)'*rand(ones(1:hi))';
 
203
yt=y;
 
204
// initialize plotted variables
 
205
x=x0;
 
206
// loop
 
207
ft=[f2];
 
208
gt=[g];
 
209
ht=[h];
 
210
qt=[q];
 
211
rt=[r];
 
212
n=10;
 
213
for k=1:n
 
214
    // generate the state and observation 
 
215
    // at time k (i.e. xk and yk)
 
216
    [x1,y]=system(x0,f2,g,h,q,r);
 
217
    x=[x x1];
 
218
    yt=[yt y];
 
219
    x0=x1;
 
220
    ft=[ft f2];
 
221
    gt=[gt g];
 
222
    ht=[ht h];
 
223
    qt=[qt q];
 
224
    rt=[rt r];
 
225
end
 
226
// get the wiener filter estimate
 
227
[xs,ps,xf,pf]=wiener(yt,m0,p0,ft,gt,ht,qt,rt);
 
228
// plot result
 
229
a=min([x(1,:)-2*sqrt(ps(1,1:2:2*(n+1))),xf(1,:),xs(1,:)]);
 
230
b=max([x(1,:)+2*sqrt(ps(1,1:2:2*(n+1))),xf(1,:),xs(1,:)]);
 
231
c=min([x(2,:)-2*sqrt(ps(2,2:2:2*(n+1))),xf(2,:),xs(2,:)]);
 
232
d=max([x(2,:)+2*sqrt(ps(2,2:2:2*(n+1))),xf(2,:),xs(2,:)]);
 
233
xmargin=max([abs(a),abs(b)]);
 
234
ymargin=max([abs(c),abs(d)]);
 
235
a=-0.1*xmargin+a;
 
236
b=.1*xmargin+b;
 
237
c=-0.1*ymargin+c;
 
238
d=.1*ymargin+d;
 
239
// plot frame, real state (x), and estimates (xf, and xs)
 
240
scf();
 
241
plot([a a b],[d c c]);
 
242
plot2d(x(1,:)',x(2,:)',[2],"000")
 
243
plot2d(xf(1,:)',xf(2,:)',[2],"000")
 
244
plot2d(xs(1,:)',xs(2,:)',[2],"000")
 
245
// mark data points (* for real data, o for estimates)
 
246
plot2d(xs(1,:)',xs(2,:)',[-2],"000")
 
247
plot2d(xf(1,:)',xf(2,:)',[-3],"000")
 
248
plot2d(x(1,:)',x(2,:)',[-4],"000")
 
249
 ]]></programlisting>
 
250
    </refsection>
 
251
    
 
252
</refentry>