Plot Y derivative and find resulting X value minimum

4 vues (au cours des 30 derniers jours)
Gavin Seddon
Gavin Seddon le 23 Nov 2015
Commenté : Star Strider le 3 Mai 2016
, I have X and Y data as time and distance. I would like to find the derivative the Y values and plot this. Therefore yielding an acceleration time graph (2nd derivative). Next it is necessary to calculate the minimum of this curve. How do I find the derivative of the entire Y column to generate the new plot and then do I calculate the minimum with fminbnd? Thank yo.

Réponse acceptée

Star Strider
Star Strider le 23 Nov 2015
Use the gradient function to calculate the first derivative, the del2 function to calculate the second derivative, and the min function to find the minimum.
  8 commentaires
Gavin Seddon
Gavin Seddon le 3 Mai 2016
Hello Star Strider apologies for the long delay. I have been considering using the Z axes to show the second differential by plotting the first differential on it.
How would I take the first differential of the column Y values and append these new values into an additional column of the same table. I made then use the curve fitting tool to select the X, Y and Z axes? Gavin.
Star Strider
Star Strider le 3 Mai 2016
No worries.
I am not certain what you want to do. If you want to plot vectors in 3D, consider the plot3 function. Use the same independent variable, then plot each vector (function, first derivative, second derivative) as function so it. (I don’t have the Curve Fitting Toolbox, so I can’t help you with its functions.)
For example:
x = ...;
y = ...;
h = mean(diff(x));
d1y = gradient(y,h);
d2y = del2(y,h);
figure(1)
plot3(x,y, x,d1y, x, d2y)
grid on
legend('Function','First Derivative','Second Derivative')
I’m not certain what you want to do, but if I were to plot them in 3D, I would use plot3.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by