<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<font face="Courier New">Dear all,<br>
<br>
The function integrate() is very handy to obtain a numerical
primtive of a function, particularly useful when there is no
closed form for the primitive or it is too involved. According to
the documentation<br>
<br>
</font>
<blockquote><font face="Courier New">x = integrate(expr, v, x0, x1
[, atol [, rtol]])</font><br>
<br>
<font face="Courier New">expr: </font><font face="Courier New">a
character string defining a Scilab expression.<br>
v: a character string, the integration variable name<br>
</font></blockquote>
<font face="Courier New"><br>
However there is a case that would be interesting to handle, and
it is when one has a set of experimental (or simulated) data xk,
yk. Here there is no expression defining a function.<br>
<br>
One way to circumvent this is using as the expression some sort of
interpolator such as <br>
<br>
x = integrate("interp1(xk, yk, x, ''spline'')", "x", x0, x1)<br>
<br>
This works, but for some reason I don't quite understand it is
very slow.<br>
<br>
For instance,<br>
<br>
x0 = 0<br>
x1 = 0:0.01:2*%pi;<br>
y1 = sin(x1);<br>
<br>
tic<br>
X = integrate("interp1(x1, y1, x, ''spline'')", "x", x0, x1);<br>
toc<br>
<br>
Requires 27 s to execute. In the meantime, control is seemingly
returned to the console, one can enter instructions, but then the
program freezes until the integrate comand finishes.<br>
<br>
Changing "spline" to "linear" even worsens it rising to 33 s.<br>
<br>
Has anybody an idea of what can be happening?<br>
<br>
Maybe it computes the full interpolator for each single point?
Even if so, I have only 629 values of the independent variable.<br>
<br>
Regards,<br>
<br>
Federico Miyara<br>
<br>
<br>
<br>
</font>
</body>
</html>