I have a problem to derive an interpolation function. I am quite new to mathematica, so I suspect I miss something.

I have a list of values of 1000 values (L) that represents a function that I want to derive. The list looks like this : enter image description here

I interpolate the list

InterL = Interpolation[L, InterpolationOrder -> 1]

I verify that the interpolation works :

In[399]:= InterL[400.6]

Out[399]= 686.8

If I plot InterL I have a similar curve as L except that is defined on everypoint.

Now if I try to derive InterL and plot it I get this curve : enter image description here

Which doesn't look like the derivative of the precedent. I have tried to evaluate the derivative, etc. I can't find a solution.

Is it possible to derive this curve ?

  • 1
    $\begingroup$ With InterpolationOrder->1, the derivative will be stepped . Try using order 3 instead. $\endgroup$ – flinty Jul 22 '20 at 17:05
  • $\begingroup$ I have just tried. It doesn't work. It gives me the following ibb.co/QrfhrGN $\endgroup$ – Vincent Jul 22 '20 at 17:22
  • 1
    $\begingroup$ InterpolationOrder -> 3 works for me. So does Method -> "Spline". Not sure what you did wrong. Problems with code usually require the code to solve the problem. $\endgroup$ – Michael E2 Jul 22 '20 at 17:24
  • $\begingroup$ Is your data L of the form {y1,y2,y3,...,yn} just a list of values, or of the form {{x1,y1}, {x2,y2}, {x3,y3},...,{xn,yn}} where it has x and y coordinates? Try with both x and y coordinates if not. $\endgroup$ – flinty Jul 22 '20 at 17:27
  • $\begingroup$ I am really sorry, I can't find what is wrong in my Notebook. I have a MWE in the following link. A matrix then the few line of interpolation, derivation and plotting. drive.google.com/file/d/1kOXP1MMRJ7ZRSdwk-zurTF_fJG5dDylP/… I tried with a matrix and a list extracted from it and it doesn't work. $\endgroup$ – Vincent Jul 24 '20 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.