MATLAB Answers

Requesting help!! please give code for real fractional differentiation

1 view (last 30 days)
Ramachandran M.G.
Ramachandran M.G. on 31 Jan 2012
Answered: sheng350 on 27 Jun 2016
Hi guys,
please help me!
I wrote a code for real fraction differentiation,but i'm facing some problem in running time.
code:
% This function calculates the fractional derivative of order d for the
% given function r(t). It is assumed that the vector r contains the
% samples of the continuous signal r(t) which we are going to calculate its
% fractional derivative. h is a constant and represents the sampling
% period of r(t) (the time period between two samples). h must be small
% enough in the sense of Nyquist sampling theorem.
% y is the result achieved by applying the fractional differentiation
% operator on the input r. This contains the samples of the real output
% y(t) with the same sampling period used for r.
% It makes use of the Grnwald-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
here
g=imread('cameraman.tif');
r=g(:);
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);
but in running time its taking lot of time or its not come out from the for loop .
Also I don't sure about code ,If any one know the code about real fractional derivative please let me know!
Thanks in Advance!!

  0 Comments

Sign in to comment.

Answers (2)

Manuel Ortigueira
Manuel Ortigueira on 4 Feb 2012
I am not sure about what is happening. Probably a problem with the computation of the binomial coefficients. These must be computed recursively, because the gamma computation is bad for high values of the argument. Remember that the binomial coefficients are equal to (-d)k/k! where I represented the Pochammer coefficient by (-d)k. Besides, if you are using Matlab, I suggest you to use other variables, because i and j are used in Matlab for representing the imaginary unity sqrt(-1). Try this. I would you suggest that, at the end, remove the initial calculated points because they are bad due to the transient of the derivative operator.

  0 Comments

Sign in to comment.


Sign in to answer this question.