blob: 9055609c41839a34e1dfabc072a392c3c0c85b67 (
plain)
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
|
// <-- Non-regression test for bug 2330 -->
//
// <-- Bugzilla URL -->
// http://www.scilab.org/cgi-bin/bugzilla_bug_II/show_bug.cgi?id=2330
//
// <-- Short Description -->
// datafit does not work equivalently on WinXP and Linux. With a given dataset and
// same routines centered on datafit function, it works perfectly on Linux and
// partially (some data are fitted some others not) on WinXP.
// Serge Steer - Scilab Project
// Copyright INRIA
// 30 apr 2007
//build the data to fit
//---------------------
function Xcalc=biexp(p,t)
Xcalc=p(1).*exp(-p(2).*t)+p(3).*exp(-p(4).*t)+p(5);
endfunction;
t=(0:100:36000)';
p=[0.1;0.0001;0.2;0.0002;0.3];
X=biexp(p,t);
//try to fit the data
//-------------------
//the error function
function e=myerf(p,X,t),e=X-biexp(p,t),endfunction
// the initial point
p0=[0.01;0.001;0.01;0.001;0.1];
//call datafit
[pr,err]=datafit(list(myerf,t),X,p0);
affich_result(err<5d-6,2330);
|