Discussion:
Derivative of a List
(too old to reply)
ch akpovo
2003-06-26 09:49:56 UTC
Permalink
Hello,
I created a two columns table from experimental data say v (t) and would
like to compute the derivatives. How do I proceed.
Thanks
Florian Jaccard
2003-06-27 10:30:59 UTC
Permalink
Hello !

You can use the numerical differentiation formulas :

v'(t)=(v(t+h)-v(t))/h + 0(h)

This is a good approximation if differnces of t's are small and irregular.

1) If the list of t is not regular :

liste = {{0., 2.}, {1., 2.5}, {2., 3.2}, {2.8, 3.6}};

numder[i_] := (liste[[i + 1,2]] - liste[[i,2]])/
(liste[[i + 1,1]] - liste[[i,1]])


vprime = Join[Table[numder[i], {i, 1, Length[liste] - 1}],
{numder[Length[liste] - 1]}];

TableForm[Transpose[Join[Transpose[liste], {vprime}]],
TableHeadings -> {{}, {"t", "v(t)", "v'(t)"}}]

If the intervals of t are regular, it is better tu use :

v'(t)=(v(t+h)-v(t-h))/(2h)+ 0(h^2)

2) If the list of t is regular :

In[7]:=
liste = {{0., 2.}, {1., 2.5}, {2., 3.2}, {3., 3.6}};

In[8]:=
betterNumder[i_] := (liste[[i + 1,2]] -
liste[[i - 1,2]])/(liste[[i + 1,1]] -
liste[[i - 1,1]])

In[9]:=
vprime = Join[{numder[1]}, Table[betterNumder[i],
{i, 2, Length[liste] - 1}],
{numder[Length[liste] - 1]}];

In[10]:=
TableForm[Transpose[Join[Transpose[liste], {vprime}]],
TableHeadings -> {{}, {"t", "v(t)", "v'(t)"}}]

3) If you have a lot of regular values, you can use the very good
Richardson formula :

v'(t)=(8*(v(t+h/2)-v(t-h/2))-v(t+h)+v(t-h))/(6h) + 0(h^4)

Greetings

F.Jaccard

-----Message d'origine-----
De : ch akpovo [mailto:***@cennas.nhmfl.gov]
Envoyé : jeu., 26. juin 2003 11:36
À : ***@smc.vnet.net
Objet : Derivative of a List


Hello,
I created a two columns table from experimental data say v (t) and would
like to compute the derivatives. How do I proceed.
Thanks
Peter Hahn
2003-07-01 12:54:38 UTC
Permalink
Post by ch akpovo
Hello,
I created a two columns table from experimental data say v (t) and would
like to compute the derivatives. How do I proceed.
Thanks
Hi,

if t is in uniform intervals, you can also use a derivative
Savitzky-Golay Filter. This filter also performs a smoothing of the
data.

Hope that helps,

Peter

Continue reading on narkive:
Loading...