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

« back to all changes in this revision

Viewing changes to man/fr/elementary/lsq_splin.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>lsq_splin</TITLE>
 
6
  <TYPE>Scilab Function</TYPE>
 
7
  <DATE>February 2004</DATE>
 
8
  <SHORT_DESCRIPTION name="lsq_splin">weighted least squares cubic spline fitting</SHORT_DESCRIPTION>
 
9
 
 
10
  <CALLING_SEQUENCE>
 
11
  <CALLING_SEQUENCE_ITEM> [y, d] = lsq_splin(xd, yd [, wd], x)</CALLING_SEQUENCE_ITEM>
 
12
  </CALLING_SEQUENCE>
 
13
 
 
14
  <PARAM>
 
15
    <PARAM_INDENT>
 
16
     <PARAM_ITEM>
 
17
        <PARAM_NAME>xd, yd</PARAM_NAME>
 
18
        <PARAM_DESCRIPTION>
 
19
         <SP>: vectors of the same size, datas to be fitted by a cubic spline</SP>
 
20
        </PARAM_DESCRIPTION> 
 
21
     </PARAM_ITEM>
 
22
     <PARAM_ITEM>
 
23
        <PARAM_NAME>wd</PARAM_NAME>
 
24
        <PARAM_DESCRIPTION>
 
25
         <SP>: (optionnal) a vector of same format than <VERB>xd</VERB> and  <VERB>yd</VERB>, 
 
26
               weights of the least square fit.</SP>
 
27
        </PARAM_DESCRIPTION> 
 
28
     </PARAM_ITEM>
 
29
     <PARAM_ITEM>
 
30
        <PARAM_NAME>x</PARAM_NAME>
 
31
        <PARAM_DESCRIPTION>
 
32
         <SP>: a strictly increasing (row or column) vector, breakpoints of the
 
33
               cubic spline</SP>
 
34
        </PARAM_DESCRIPTION> 
 
35
     </PARAM_ITEM>
 
36
     <PARAM_ITEM>
 
37
        <PARAM_NAME>y, d</PARAM_NAME>
 
38
        <PARAM_DESCRIPTION>
 
39
         <SP>: vectors of same format than <VERB>x</VERB>, the triplet (x,y,d) defines the approximated
 
40
               cubic spline.</SP>
 
41
        </PARAM_DESCRIPTION> 
 
42
     </PARAM_ITEM>
 
43
   </PARAM_INDENT>
 
44
  </PARAM>
 
45
  
 
46
  <DESCRIPTION>
 
47
    <P>
 
48
    This function computes an approximated cubic spline <EM>s</EM> for the datas 
 
49
    <VERB>xd, yd, wd</VERB> (in the following <EM>m</EM> is supposed to be the 
 
50
    length of these vectors) and from a choice of the spline breakpoints <VERB>x</VERB> 
 
51
    (for instance if you want n breakpoints uniformly choosen you may use 
 
52
    <TT>x=linspace(min(xd),max(xd),n))</TT>). If <EM>S</EM> is the space of all
 
53
    cubic splines functions with breakpoints <EM>x1 &lt; x2 &lt; ... &lt; xn</EM> then 
 
54
    the resulting spline <EM>s</EM> is such that:
 
55
    </P>
 
56
        <VERBATIM><![CDATA[
 
57
     _m_                               _m_                       
 
58
     \                           2     \                           2
 
59
     /   wd(k) (s(xd(k)) - yd(k))  <=  /   wd(k) (f(xd(k)) - yd(k))    
 
60
     ---                               ---  
 
61
     k=1                               k=1
 
62
          ]]></VERBATIM>
 
63
     <P> for all <EM>f in S</EM>, i.e. realizes the minimum of the sum of the squared errors 
 
64
         over all functions of <EM>S</EM>.
 
65
    </P>
 
66
    <P>
 
67
    The spline <EM>s</EM> is completly defined by the triplet <VERB>(x,y,d)</VERB> 
 
68
    (<VERB>y</VERB> and <VERB>d</VERB> are the vectors of the spline ordinates and
 
69
    first derivatives at the xi 's : <EM>yi=s(xi)</EM> and <EM>di=s'(xi)</EM>) and 
 
70
    its evaluation at some points must be done by the <LINK>interp</LINK> function.
 
71
    </P>
 
72
    </DESCRIPTION>
 
73
 
 
74
    <SECTION label="Remarks">
 
75
    <P> When <VERB>wd</VERB> is not given, all the points have the same weight 1.</P>
 
76
    <P> A point <EM>(xd(k),yd(k))</EM> is considered in the fit if <EM>xd(k) in [x1,xn]
 
77
        and  wd(k) &gt; 0</EM>. In particular you can put a null (or even negative) weight to
 
78
        all data points you want to ignore in the fitting. When the total number of points
 
79
        taken into account in the fit procedure is (strictly) less than 4 an error is issued.  
 
80
    </P>
 
81
    <P> The vector <VERB>xd</VERB> do not need to be in increasing order. 
 
82
    </P>
 
83
    <P> Depending on the number and on the positions of the <EM>xd(k)</EM> 's and on the choice 
 
84
        of the <EM>x(i)</EM> 's there may be several solutions but only one is selected. When this
 
85
        occurs a warning message is displayed in the Scilab command window. This function is intended 
 
86
        to be used when <EM>m</EM> is much larger than <EM>n</EM> and in this case no such problem
 
87
        may occured.
 
88
    </P>
 
89
    </SECTION>
 
90
  <EXAMPLE><![CDATA[
 
91
// this is an artifical example where the datas xd and yd
 
92
// are build from a perturbed sin function
 
93
a = 0; b = 2*%pi;
 
94
sigma = 0.1;  // standard deviation of the gaussian noise
 
95
m = 200;       // number of experimental points
 
96
xd = linspace(a,b,m)';
 
97
yd = sin(xd) + grand(xd,"nor",0,sigma);
 
98
 
 
99
n = 6; // number of breakpoints
 
100
x = linspace(a,b,n)';
 
101
 
 
102
// compute the spline
 
103
[y, d] = lsq_splin(xd, yd, x);  // use equal weights
 
104
 
 
105
// plotting
 
106
ye = sin(xd);
 
107
ys = interp(xd, x, y, d);
 
108
xbasc()
 
109
plot2d(xd,[ye yd ys],style=[2 -2 3], ...
 
110
       leg="exact function@experimental measures (gaussian perturbation)@fitted spline")
 
111
xtitle("a least square spline")
 
112
xselect()
 
113
 ]]></EXAMPLE>
 
114
 
 
115
  <SEE_ALSO>
 
116
    <SEE_ALSO_ITEM>
 
117
      <LINK>interp</LINK>
 
118
    </SEE_ALSO_ITEM>
 
119
    <SEE_ALSO_ITEM>
 
120
      <LINK>splin</LINK>
 
121
    </SEE_ALSO_ITEM>
 
122
  </SEE_ALSO>
 
123
 
 
124
  <AUTHORS>
 
125
     <AUTHORS_ITEM> C. De Boor, A.H. Morris  (code from the NSWC fortran lib)</AUTHORS_ITEM>
 
126
     <AUTHORS_ITEM> B. Pincon (scilab interface and slight modifications)</AUTHORS_ITEM>
 
127
  </AUTHORS>
 
128
</MAN>