To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=95135
User jbfaure changed the following:
What |Old value |New value
================================================================================
CC|'' |'jbfaure'
--------------------------------------------------------------------------------
------- Additional comments from [EMAIL PROTECTED] Sat Oct 25 10:09:39 +0000
2008 -------
I confirm it's very hard to design a formula to do linear interpolation. The
best way is to use a function.
Some time ago (OOo 2.x) I wrote such kind of function. Here is my code, you can
use and adapt it (sorry comments are in French) :
function interpoler (X as variant, Y as variant, T as double)
' on verifie si on a bien des ARRAY
if NOT (IsArray( X ) AND IsArray( Y )) then
Err = 519
interpoler = "#VALUE"
else
Dim debut as integer, fin as integer, length as Integer
Dim result As Double
debut = LBound(X)
fin = UBound(X)
length = fin-debut
Dim X1 as double, X2 as double, Y1 as double, Y2 as double
'on suppose que X est trié par ordre croissant
If (t < X(debut,1)) then 'avant on prend la première valeur
interpoler = Y(debut,1)
'interpoler = "#VALEUR !"
Exit function
End if
If (t >= X(fin,1)) then 'après on garde la dernière valeur
interpoler = Y(fin,1)
'interpoler = "#VALEUR !"
Exit function
End if
'X1 = X(debut,1)
For i = 0 to length-1
If (X(debut+i,1) <= t AND X(debut+i+1,1) > t) then
X1 = X(debut+i,1)
X2 = X(debut+i+1,1)
Y1 = Y(debut+i,1)
Y2 = Y(debut+i+1,1)
Exit For
End if
Next
'interpolation linéaire
interpoler = y1 + (y2-y1)/(x2-x1)*(t-x1)
end if
End Function
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]