Group Abstract Group Abstract

Message Boards Message Boards

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

Derivative of a list of data values

Dear All,

I want to ask your advise. I have a variable q as a function of time but I already have the values of q for each time step. So do you know any command in Mathematica for getting the derivative values of q? There are some commands such as: dq/dt = D[q[t],t] or dq/dt = q'[t] but I think I can use that command if I have q as an equation but I have q as values.

So I used the below method to calculate the derivative:

dqdt = Table[(q[t + 1] - q[t - 1])/2, {t, 1, 99}]

Please refer to attach. titled "Derivative.nb" for the script. So may I know if the above method is correct? And may I know the alternative ways for calculating derivative like in this case? Thanks a lot for your kind attention.

Best Regards, Intan

Attachments:
POSTED BY: INTAN SUPRABA
6 Replies
POSTED BY: Shenghui Yang
POSTED BY: INTAN SUPRABA
POSTED BY: Nasser M. Abbasi

Dear Nasser,

Thanks a lot for your response. But sorry as I am still confused. Yes I already have an interpolation function called q. Then I use the derivative command: dqdt = Do[Print[D[q[t], t]], {t, 0, 100}] and I got the another interpolation like what you said. But the results of the derivative is not as per expected (please refer to attach. "Derivative_1.nb").

So do you know what went wrong? Or did I use the wrong command to list the output of that derivative (dq/dt)? Thanks in advance for your reply.

Best Regards, Intan

Attachments:
POSTED BY: INTAN SUPRABA

had quick look. You already found an interpolation function called q. There nothing more to do. In Mathematica, you can differentiate and integration these interpolation functions like any other function. So all you have to do is

D[q[t], t]

to obtain the derivative. This will give you another interpolation function which is the derivative of q.

POSTED BY: Nasser M. Abbasi
Posted 6 years ago
POSTED BY: Updating Name
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard