cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

How to differentiate data points

ptc-1846264
1-Newbie

How to differentiate data points

I have X and Y co-ordinates that i am trying to differentiate. At first i tried the fit function followed by the derivative, but it keeps on giving me error.If any one know how to do this, i would greatly appriciate it.
7 REPLIES 7
RichardJ
19-Tanzanite
(To:ptc-1846264)

By x and y coordinates do you mean measured data? If that's what you mean, create a spline function and differentiate that: coeffs:cspline(dataX,dataY) f(x):interp(coeffs,dataX,dataY,x) take the derivative of f(x) Richard

It works up to a point but Mathcad 14 does not want to take the derivative of f(x).I had tried that before and thought i was doing something wrong. And yes, I did mean measured data. Here is the file that i am working with. Thanks
RichardJ
19-Tanzanite
(To:ptc-1846264)

The data table in the worksheet is empty. Richard

Sorry for that,here is the actual data that was imported in mathcad from excel.The X and Y are from column Aand B respectively. I was able to use the following fromula to get the derivative but it was not as acurate as i wanted it to be. I know that the cspline function basically fits a function over the one that the points generate. As far as finding the derivative of that function, that where i'm stuck. Dyn=((Yn+1)-Yn)/(Xn+1-Xn) Plotting Dyn vs Xn gives the derivative. Thanks Edward
RichardJ
19-Tanzanite
(To:ptc-1846264)

It's just a bad error message. Mathcad 14 has lots of them. Never believe any error message from either a graph or a solve block. The problem is that you are passing a vector of values to the function df(x), which expects a scalar. Some Mathcad functions handle vectors of values automatically, but not all of them. If you evaluate df(x) outside the graph, that's the error you get. Use the vectorize operator on df(x) and it works. As an aside, you do not need to define x:X. In the definition of f(x) x is a proper argument, and just tells Mathcad where the argument in that location (in this case there is only one argument, but there could be many) must be used in the function. Once defined, you can call it with anything, including X. Richard

Thanks it works fine. In my original file that i sent how do i interpolate so that i can get more data points from f(x), thus making my plot more acurate. Thanks Edward
RichardJ
19-Tanzanite
(To:ptc-1846264)

You can fill in more values, but whether that makes the plot more accurate is debatable. The excursions of the spline where it has maxima and minima are not likely to be accurate. Richard
Top Tags