diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/nonRegression/bug2330.sci | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/nonRegression/bug2330.sci b/tests/nonRegression/bug2330.sci new file mode 100644 index 0000000..af4a96d --- /dev/null +++ b/tests/nonRegression/bug2330.sci | |||
@@ -0,0 +1,28 @@ | |||
1 | // Non-regression test file for bug 2330 | ||
2 | // Serge Steer - Scilab Project | ||
3 | // Copyright INRIA | ||
4 | // 30 apr 2007 | ||
5 | |||
6 | mode(-1); | ||
7 | clear; | ||
8 | |||
9 | //build the data to fit | ||
10 | //--------------------- | ||
11 | function Xcalc=biexp(p,t) | ||
12 | Xcalc=p(1).*exp(-p(2).*t)+p(3).*exp(-p(4).*t)+p(5); | ||
13 | endfunction; | ||
14 | t=(0:100:36000)'; | ||
15 | p=[0.1;0.0001;0.2;0.0002;0.3]; | ||
16 | X=biexp(p,t); | ||
17 | |||
18 | //try to fit the data | ||
19 | //------------------- | ||
20 | //the error function | ||
21 | function e=myerf(p,X,t),e=X-biexp(p,t),endfunction | ||
22 | // the initial point | ||
23 | p0=[0.01;0.001;0.01;0.001;0.1]; | ||
24 | //call datafit | ||
25 | [pr,err]=datafit(list(myerf,t),X,p0); | ||
26 | affich_result(err<5d-6,2330); | ||
27 | clear | ||
28 | |||