微积分定义% This function calculates the fractional derivative of order 揹�for the
% given function r(t). It is assumed that the vector 搑�contains the
% samples of the continuous signal r(t) which we are going to calculate its
% fractional derivative. 揾�is a constant and represents the sampling
% period of r(t) (the time period between two samples). 揾�must be small
% enough in the sense of Nyquist sampling theorem.
% 搚�is the result achieved by applying the fractional differentiation
% operator on the input 搑� This contains the samples of the real output
% y(t) with the same sampling period used for 搑�
% It makes use of the Gr黱wald-Letnikov definition. The first element of
% the vector "r", i.e. r(1), is always zero.
%
% d : the order of fractional differentiation
% r : samples of the signal to be differentiated
% h : sampling poriod
function [y] = fderiv(d,r,h)
temp = 0;
for i=1:length(r)
for j=0:i-1
temp = temp+(-1)^j*(gamma(d+1)/(gamma(j+1)*gamma(d-j+1)))*r(i-j);
end
y(i) = temp;
temp = 0;
end
y = y/(h^d);