MATLAB: Finding slope of a curve at some specific points

at different pointsslope

Hi
I have a a column data set which is the transverse strain of a composite material. I want to calculate slope of it at some specific points

Best Answer

Your data appear to be smooth enough that you could fit them with a low-order (about 3 or 4) polynomial with polyfit, dividing ‘Index’ by 1E+5 first. Then use polyder to take the derivative of the polyfit coefficients, and use polyval to evaluate the derivative at the values of ‘Index’ you want.