The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: diff and gradient function, derivative of a vector
Replies: 3   Last Post: Sep 1, 2010 12:26 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Md. Shahriar Karim

Posts: 56
Registered: 2/2/09
Re: diff and gradient function, derivative of a vector
Posted: Jul 16, 2010 11:51 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Yi Cao" <> wrote in message <i1p2vn$556$>...
> "Md. Shahriar Karim" <> wrote in message <i1oouo$a1o$>...
> > Hi,
> >
> > I am given a vector say A= [.....................] that describe a function say f(x). Now, I have to calculate the derivetive d(A)/d(x). x = 1: N and is equally spaced with any equal width (0.1 or 0.5 or 1 or anything). I was using both
> > diff (A)
> > gradient (A)
> >
> > however, the derivative value I get using diff and gradient result in different output when cascaded to in next calculation. Becasue, my last calculation is highly sensitive of derivative (d(A)/d(x)) value as the derivative value I am using to plot the cramer-rao bound for an estimator.
> >
> > Could you please say which process amongst diff (A) and gradient (A) is more accurate in finding the derivative of a vector?
> >
> > Is there anyother way that can be used to obtain the same with even greater accuracy? Thanks,
> >
> >
> > Karim

> Neither diff nor gradient is reliable in this application. You can use either finite difference (FD) or automatic differentiation (AD) to calculate dA/dx. There are some tools in File Exchange available for both FD and AD. For example:
> For FD, my Complex Step Jacobian tool will be useful,
> To use this tool, if your function has transpose ('), you have to convert it to (.').
> For AD, the recent submission may be useful:
> Yi

Hi, if i use the adiff function to calculate the derivative, how will we use this?
For example, vecotr A = [1......N] is describing the function but we do NOT know what kind of equation does it have. All we know is that the function has some value on some different points (X = 1,2,... ....say 30)).

How would the adiff and adiffget would fit in this case? I saw that to use adiffget we have got to have a existing equation that governs the relation between X (points where derivative to be calculation) and function (X).




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.