f =
It works for the numerical "besselj" function.
Its derivative is given here:
n = 40;
x = 0:0.1:100;
y = sqrt(pi./(2*x)).*besselj(n+0.5,x);
% Derivative of y with respect to x
dy = -sqrt(pi)./(2*x).^(1.5).*besselj(n+0.5,x)+sqrt(pi./(2*x))*0.5.*(besselj(n+0.5-1,x)-besselj(n+0.5+1,x));
figure(1)
plot(x,[y;dy])
grid on
Or you work with symbolic precision:
syms x
y = sqrt(pi/(2*x))*besselj(n+0.5,x);
dy = diff(y,x);
xnum = 0.1:0.1:100;
ynum = subs(y,x,xnum);
dynum = subs(dy,x,xnum);
figure(2)
plot(xnum,[ynum;dynum])
grid on