diff(f) would invoke f with no arguments, fetch its return value, and apply the numeric diff() function to it, where the numeric diff() function is (X(2:end) - X(1:end-1)).
If you have the symbolic toolbox, you could try
syms t
df = diff(f(t),t);
f2 = diff(df,t);
f1 = inline(char(f(t)));
df1 = inline(char(df));
df2 = inline(char(f2));
Or more directly,
syms t
ft = f(t);
df = diff(ft,t);
f2 = diff(df, t);
f1 = @f;
df1 = matlabFunction(df, 'vars', t);
df2 = matlabFunction(f2, 'vars', t);
f
Best Answer