Am looking for recommendations about how to create a vector of derivatives given a vector of values.
In this case, I have an array with temperatures at different times (evenly spaced). I want to create an array of temperature derivatives. (I anticipate losing a few points at the ends.)
Could write a loop, I suppose, dT/dt_i = (T_i+1 - T_i)/dt
But there are 20,000 points.
Is there some vectorized scheme or existing function that I should look into?
Thanks.
Subject: Create a vector of derivatives, given a vector of values
Thanks. "help diff" works much better than "help derivative." :)
Turns out the data is a little noisy, so estimating the derivative by comparing just two adjacent points produces oscillating derivatives.
Are there existing tools to smooth this out?
Regards.
"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <gd6k3j$515$1@fred.mathworks.com>...
> "Johan " <robert.mchugh@ips.invensys.com> wrote in message <gd6dfl$be8$1@fred.mathworks.com>...
>
> > Is there some vectorized scheme or existing function that I should look into?
>
> help diff
>
> Bruno
Subject: Create a vector of derivatives, given a vector of values
"Johan " <robert.mchugh@ips.invensys.com> wrote in message <gd7lnq$h82$1@fred.mathworks.com>...
>
> Are there existing tools to smooth this out?
>
> Regards.
>
You might fit (avoid interpolate) the data with a model, then take a derivative of a fitted model. If you don't know the model, then using a universal cubic spline for model could better way than diff.
Bruno
Subject: Create a vector of derivatives, given a vector of values
"Johan " <robert.mchugh@ips.invensys.com> wrote in message <gd6dfl$be8$1@fred.mathworks.com>...
> Am looking for recommendations about how to create a vector of derivatives given a vector of values.
>
> In this case, I have an array with temperatures at different times (evenly spaced). I want to create an array of temperature derivatives. (I anticipate losing a few points at the ends.)
>
> Could write a loop, I suppose, dT/dt_i = (T_i+1 - T_i)/dt
> But there are 20,000 points.
>
> Is there some vectorized scheme or existing function that I should look into?
>
> Thanks.
Yes. Just look for a Savitsky-Golay tool. There
are many of them on the file exchange. Here
are a couple of them.
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Terms prior to use.