As the title suggests, I am wondering how I can find the derivative of a 'function'. I am unsure what to do because I really do not have a function defined, just an array of values. So lets try a simple example:
x = 1:5;
y = x.^2
y =
1 4 9 16 25
As expected. Now I want to take the derivative. I know that this is 2x. Possibly use the diff function, as if in symbolic toolkit?
diff(y)
ans =
3 5 7 9
This looks like either 2x +// 1, with length length(y)-1. Is there any way I can compute the derivative of this and get a vector of length(y)?
I do not have the symbolic toolkit.
There is little you can do. This topic has already been discussed ad nauseum at the MathWorks web forums.
@noah has provided an example of numerical differentiation (ie: differencing) on a finite data set, whereas you are looking for a means of doing symbolic differentiation of continuous-domain-continuous-range function applied to a discrete-domain data set.
In short, not happening. You're asking how to install a shelf without a hammer, screw driver, or nails. You could always just download and install GNU Octave, a free alternative to MATLAB.
References.