How to find two local slopes in an arbitrary curve?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am used Matlab to find a model from curves. So i am processing curvesand i have some difficult to find two local slopes?
For information i am not an expert in math.
Thanks for help!
Best regards
2 comentarios
Jan
el 3 de Jun. de 2013
What does "processing curves" exactly mean? Do youz have two vector of x- and y_values? Or a sheet of paper with a hand-drawn line?
Respuestas (5)
Iain
el 3 de Jun. de 2013
The general expression to calculate "slope" is (y2 - y1) / (x2 - x1)
If you have a vector of "y" values and "x" values of the same length, you can:
slope = diff(y) ./ diff(x);
slope_x_vals = (x(2:end) + x(1:end-1))/2;
plot(slope_x_vals,slope_y_vals)
If your y value is in metres, and your x value is in seconds, the units of "slope" is metres per second.
0 comentarios
Jan
el 3 de Jun. de 2013
The gradient function calculates the slope in a fast and stable way.
0 comentarios
Jules Ray
el 16 de Jun. de 2015
Use ginput (four in this case) to the boundaries or the limits that enclose both areas, for each area use for polyfit, and lineal interpolations, this allows estimates the slope but also the associated 2 sigma error of your measurements
0 comentarios
Ver también
Categorías
Más información sobre Curve Fitting Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!