how to find slop of a curve at a point?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
i have to series of data:
x=[0.01324, 0.152784,1.426024,14.76958,147.6958,1527.888,15229.85]
y=[0.0000025,0.0000075,0.000025,0.000075,0.00025,0.0008,.0025]
I plot these points then I have a curve I want to find slope at each points of this curve(points were in data) I don't know how? please help me
0 comentarios
Respuestas (1)
arich82
el 21 de Nov. de 2014
There are several ways to compute the derivative numerically, cf.
help diff
but this can be noisy, and isn't terribly precise for data with large gaps. If this is truly data, you might want to look at the loglog plot
loglog(x, y, '.')
You'll see it's very nearly linear in log-log.
Assuming you're not using any toolboxes, you can look at
help ployfit
to perform a regression on log(x), log(y), or use the backslash operator to find a linear fit.
x=[0.01324, 0.152784,1.426024,14.76958,147.6958,1527.888,15229.85];
y=[0.0000025,0.0000075,0.000025,0.000075,0.00025,0.0008,.0025];
n = numel(x);
X = log(x(:));
Y = log(y(:));
M = [ones(n, 1), X]\Y;
C = exp(M(1));
b = M(2);
loglog(x, y, '.', x, C*x.^b);
Now that you have a good fit for your data, use the expression C*x.^b to interpolate it, and analytically compute your derivative for any value of x.
This isn't exactly what you asked, so let me know if this helps (or if you truly prefer a numerical derivative, and are struggling with diff).
--Andy
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!