# fractional derivative of Ln(x) ?

9 views (last 30 days)
esam baker on 9 Aug 2022
Commented: esam baker on 9 Aug 2022
Is there CODE for fractional derivative of Ln(x) Like in maple
F(x)=Ln(x)
a=alpha
d^a F/dx^a ?
where alpha is a fraction order of the derivative?
##### 1 CommentShowHide None
Torsten on 9 Aug 2022
Edited: Torsten on 9 Aug 2022

Torsten on 9 Aug 2022
% Sample log between 1 and 4
h = 0.01;
t = 1:h:4;
y = log(t);
% Compute fractional derivatives with different orders
order = 0:0.1:1;
yd = zeros( length(order), length(t) );
for i=1:length(order)
yd(i,:) = fgl_deriv( order(i), y, h );
end
plot(t,yd) function Y = fgl_deriv( a, y, h )
% fgl_deriv
%
% Computes the fractional derivative of order alpha (a) for the function
% y sampled on a regular grid with spacing h, using the Grunwald-Letnikov
% formulation.
%
% Inputs:
% a : fractional order
% y : sampled function
% h : period of the sampling lattice
%
% Output:
% Y : fractional derivative estimate given y
%
% Note that this implementation is similar to that of Bayat 2007
% (FileExchange: 13858-fractional-differentiator), and takes the exact
% same inputs, but uses a vectorized formulation to accelerates the
% computation in Matlab.
%
% Contact: Jonathan dot hadida [a] dtc.ox.ac.uk
n = numel(y);
J = 0:(n-1);
G1 = gamma( J+1 );
G2 = gamma( a+1-J );
s = (-1) .^ J;
M = tril( ones(n) );
R = toeplitz( y(:)' );
T = meshgrid( (gamma(a+1)/(h^a)) * s ./ (G1.*G2) );
Y = reshape(sum( R .* M .* T, 2 ), size(y));
end
##### 1 CommentShowHide None
esam baker on 9 Aug 2022
thanks

R2021a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!