How to integrate besselk function with variable limits?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Nicolas Lamb
el 13 de Mayo de 2022
Comentada: Star Strider
el 13 de Mayo de 2022
In short, the function I am trying to arrive at is:
So far I have this code,
double x;
y=0:.1:8;
inner = @(y) besselk(5/3,y);
f= @(x) integral(inner,x,Inf);
F= @(x) x*f(x);
Power= @(x) (sqrt(3)*q^3 *B * sin(alpha)* F(x))/(2*pi*m*c^2);
but am struggling to actually plot F(x). Whenever I switch x to vary like x= 0:.1:8, I can't do the integral, but if I switch it to a double, I can't plot the function.
0 comentarios
Respuesta aceptada
Star Strider
el 13 de Mayo de 2022
One option is to use the arrayfun function to do the integration (essentially a one-line implied for loop) —
% double x;
y=0:.1:8;
inner = @(y) besselk(5/3,y);
f= @(x) integral(inner,x,Inf);
F= @(x) x.*arrayfun(@(x)f(x),x);
Power= @(x) (sqrt(3)*q^3 *B * sin(alpha)* F(x))/(2*pi*m*c^2);
figure
plot(y, F(y))
xlabel('y')
ylabel('F(y)')
.
2 comentarios
Star Strider
el 13 de Mayo de 2022
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Más respuestas (0)
Ver también
Categorías
Más información sobre Special Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!