Taking derivative of discrete data requires some fitting and then using the b-form of the polynomial.
How to make a 'good' fit and properly take derivative? I am confused what is the right behavior of the derivative. Things change quite rapidly with small adjustments of the fitting scaps coefficient 0.09 in the example below.
The test.txt data is attached.
T = load('test.txt'); x = T(:,1); y=T(:,2)
pp22 = csaps(x,y,0.09);
pp22val = ppval(pp22,x);
p_der202 = fnder(pp22,2);
y_prime22 = ppval(p_der202,x);