Derivative of intergrated bessel function
이전 댓글 표시
Hi,
I'm trying to plot a curve determined by the first and second derivatives of an expression defined using besselj. The definitions of my derivatives and my function are below :

I've succeeded in defining the function as follow, using defined scalar for the integral :
Fhertz=@(r) P*l^2/(2*pi*D)*integral(@(m) besselj(0,m.*r/l).*m./(1+m.^4),0,1000)
But now I'm trapped as I can't find a way to calculate the 2 M as defined above, Matlab seems not to accept my function when I try to use the diff function :
Mr1= @(r)-D*(1/r*diff(Fhertz)+nu/r*diff(Fhertz,2))
fplot(Mr1, [0 10*l]);
Undefined function 'diff' for input arguments of type 'function_handle'.
Error in @(r)-D*(1/r*diff(Fhertz)+nu/r*diff(Fhertz,2))
Error in fplot>splitFunctionHandle (line 255) fnAtZero = fn(0);
Error in fplot (line 119) fn{1} = splitFunctionHandle(fn{1});
Thanks in advance for your help
답변 (1개)
Steven Lord
2016년 9월 21일
You can't do math on function handles. You can do math on the values returned by function handles.
s = @sin;
c = @cos;
tNO = @(x) s./c % will not work if you try to evaluate tNO
tYES = @(x) s(x)./c(x) % will work
v = -pi:0.1:pi;
tYES(v)-tan(v) % all elements should be small
See the example "Approximate Derivatives with diff" on the documentation page for diff for how to use it to approximate a function's derivative.
댓글 수: 2
Romain Clouzeau
2016년 9월 21일
Steven Lord
2016년 9월 21일
If you call the diff function with a nonempty vector as input, the output vector has one fewer element than the input. You need to adjust for that.
Alternately, you may find the gradient function useful.
카테고리
도움말 센터 및 File Exchange에서 Bessel functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!