# Finding slope from a 2D Plot

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

• Do you have some example data? – Coolwater Jan 10 '18 at 15:39
• And explain please, what is "the first plot in Mathematica"? – Alexei Boulbitch Jan 10 '18 at 15:46
• @ Alexei Boulbitch I added an example, also by first data I meant the data I plotted the curve. – kmsin Jan 10 '18 at 15:54
• @Coolwater I added an example. – kmsin Jan 10 '18 at 15:54
• I want to plot the slop of this curve with his own data, is it possible? – kmsin Jan 10 '18 at 17:03

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}] 