Derivative of intergrated bessel function
Mostrar comentarios más antiguos
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
Respuestas (1)
Steven Lord
el 21 de Sept. de 2016
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 comentarios
Romain Clouzeau
el 21 de Sept. de 2016
Steven Lord
el 21 de Sept. de 2016
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.
Categorías
Más información sobre Bessel functions en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!