Imagine I have a set of data, the plot is as following(just as an example consider a Gaussian curve):
Is there any way to obtain the slop of this curve slop and plotted just using the initial data.
Thank alot
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityImagine I have a set of data, the plot is as following(just as an example consider a Gaussian curve):
Is there any way to obtain the slop of this curve slop and plotted just using the initial data.
Thank alot
If you want to do it numerically with a dataset, say data
data = Table[{x, Exp[-x^2]}, {x, -5, 5, 0.1}];
you can go like this
ndata = Length[data];
slope = Table[{(data[[i, 1]] + data[[i - 1, 1]])/2,
(data[[i, 2]] - data[[i - 1, 2]])/(data[[i, 1]] - data[[i - 1, 1]]) },
{i, 2, ndata}];
ListLinePlot[{data, slope}, PlotRange -> All]
Or you can go with Interpolation
f[x_] = Interpolation[data][x]; (*function for data*)
f1[x_] = D[f[x], x]; (*function for derivative*)
Plot[{f[x], f1[x]}, {x, -5, 5}]
Fit
, FindFit
or NonlinearModelFit
to find a functional form.
$\endgroup$
– Sumit
Jan 11 '18 at 17:04