Log in

View Full Version : Calculating slope and change in slope (Mathcad)


jeepey
Dec 5, 2007, 03:05 AM
Hello, I have been using mathcad for a only a few weeks, so my knowledge of it is limited.

I have a set of data points which I have created some polynomial and cubic splines on a graph.
What I want to do is calculate the slopes and change in slope of the curves.

Any help on a mathcad function that can do this would be appreciated, I was hoping I could attach my mathcad work sheet but won't let me attach the file :(

Thanks in advance :cool:

mathcad
Dec 5, 2007, 09:49 PM
If you have created the polynomial or interpolating function, you can just use the first derivative operator (click on the calculus icon/toolbar) to get the slope and use the second derivative operator to get the rate of change of the slope.

For example:

Suppose you have two sets of data vx and vy and you create the interpolating function by using cubic spline and interpolation:

vs:=cspline(vx,vy)
y(x):=interp(vs,vx,vy,x)

Then the slope is

s(x):=d/dx y(x)

The operator d/dx must be obtained from the calculus toolbar, you can't just type d/dx. The slope at any point can be calculated easily, for example at x = 2, just type s(2) and the equal sign.

jeepey
Dec 5, 2007, 11:41 PM
Thank you very much for your help,
That's worked a treat!