Thread Subject: numerical derivatives package

Subject: numerical derivatives package

From: Juliette Salexa

Date: 13 Jun, 2009 18:58:01

Message: 1 of 3

I'm looking for a package that approximates derivatives for NUMERICALLY defined functions (not analytic) ..

I have two arrays:
x=0:0.5:10 , and fun= a vector that defines my function at each of those values of x.

Now I want the derivative of fun with respect to x at each value of x.

Does such a package exist ??

I've downloaded DERIVEST by John R. D’Errico, but it seems to be for analytic functions

Subject: numerical derivatives package

From: Doug Schwarz

Date: 13 Jun, 2009 21:24:10

Message: 2 of 3

In article <h10srp$9p1$1@fred.mathworks.com>,
 "Juliette Salexa" <juliette.physicist@gmail.com> wrote:

> I'm looking for a package that approximates derivatives for NUMERICALLY
> defined functions (not analytic) ..
>
> I have two arrays:
> x=0:0.5:10 , and fun= a vector that defines my function at each of those
> values of x.
>
> Now I want the derivative of fun with respect to x at each value of x.
>
> Does such a package exist ??
>
> I've downloaded DERIVEST by John R. D’Errico, but it seems to be for
> analytic functions

Just use gradient:

  x = <some vector>
  y = f(x);
  dydx = gradient(y,x);

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.

Subject: numerical derivatives package

From: Yi Cao

Date: 13 Jun, 2009 21:30:21

Message: 3 of 3

"Juliette Salexa" <juliette.physicist@gmail.com> wrote in message <h10srp$9p1$1@fred.mathworks.com>...
> I'm looking for a package that approximates derivatives for NUMERICALLY defined functions (not analytic) ..
>
> I have two arrays:
> x=0:0.5:10 , and fun= a vector that defines my function at each of those values of x.
>
> Now I want the derivative of fun with respect to x at each value of x.
>
> Does such a package exist ??
>
> I've downloaded DERIVEST by John R. D’Errico, but it seems to be for analytic functions

Try

dadx = diff(a)./diff(x);

HTH
Yi

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com