Group Abstract Group Abstract

Message Boards Message Boards

0
|
29.5K Views
|
6 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Derivative of a list of data values

Attachments:
POSTED BY: INTAN SUPRABA
6 Replies
Posted 6 years ago

Shenghui, you make a good suggestion, but I believe the 3 point formula is better implemented as: ListConvolve[{1, 0, -1}, data[[All, 2]]] / ListConvolve[{1, 0, -1}, data[[All, 1]]]

POSTED BY: Updating Name

Also you can use the hardcore table like function to find the derivative if you do not use the interpolation function:

(*[[All, 2]]* takes all rows and pick up the second column only/ time step = 1*)
ListConvolve[{1, -1}, data[[All, 2]]] 

assuming data is

data =  {{0, 0.1425`}, {1, 0.1425`}, {2, 0.1425`}, ..., {99, 0.523363636`}}
POSTED BY: Shenghui Yang
POSTED BY: INTAN SUPRABA

What you had is this

dqdt = Do[Print[D[q[t], t]], {t, 0, 100}]

Which does not work, since "t" becomes a number, and one can't take derivative with respect to a number. You could write

dqdt = Do[Print@Evaluate[D[q[t], t] /. t -> i], {i, 0, 100}]

But it is easier to write

lst = (D[q[t], t] /. t -> #) & /@ Range[0, 100]

Or just take the derivative outside once, and evaluate it

D[q[t], t];
lst = (% /. t -> #) & /@ Range[0, 100]
POSTED BY: Nasser M. Abbasi
Attachments:
POSTED BY: INTAN SUPRABA
POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard