Requesting help!! please give code for real fractional differentiation
조회 수: 5 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Manuel Ortigueira
2012년 2월 4일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!