thank you very much for your reply...
yes, it is derived from the files. for example
As you said
t = {t(i+1) - t(i)} / 2 and the new y = y(i) + {(y(i+1) - y(i))(t-t(i))}/{t(i+1) - t(i)}, if file "sender.dat" t has (15,25,35,45,55)
y
|-------------
5-------------5
|---------4-------4----
4 -----------4----
4
|---------------------------------------------
|-2---
2-------------------------
2------------2
|------------------------------------------------> t
-10--
15--20--
25--30
--35--40--
45--50--
55--60
For example: y(i) = 2, y(i+1)=4, t(i)=10, and y(i+1)=20;
the new interpolate value are given?
y(1) = 2 + {(4-2)(15-10)}/(20-10) = 3
y(2) = 4 + {(4-4)(25-20)/(30-20) = 4
how about when
t != {t(i+1) - t(i)} / 2?
y
|
|=====
4===4======4============4
|=3==========
3=======
3====3
|===============================
2====2
|------------------------------------------------> t
-10--
-13---20---
26--3
0---39--40-----50-
52---6
0
Assume that we have the following time t (column 1 in each file) for the both nodes:
router.dat sender.dat
10 13
20 26
30 39
40 52
50
60
For example: y(i) = 2, y(i+1)=4, t(i)=10, and y(i+1)=20;
the new interpolate value are given:
y(1) = 3 + {(4-3)(13-10)}/(20-10) = 3.3
y(2) = 4 + {(4-4)(26-20)/(30-20) = 4
y(3) = 4 + {(3-4)(39-30)/(40-30) = 3.1
I did try this one, but it gave me wrong answer. I will try to change:
{ yi=$2; ti=$1; t=(yi + ylast)/2; y=ylast + ( yi - ylast ) * ( t - tlast ) / ( ti - tlast ); print t,ti,y; ylast=yi; tlast=ti; }
Quote:
Originally Posted by
otheus
So is "t" derived or is it read from a file or is it user-defined?
I tried t = (yi+ylast)/2 which seemed to produce reasonable results.