How to integrate besselk function with variable limits?

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.

 채택된 답변

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))
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.8e+34. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
xlabel('y')
ylabel('F(y)')
.

댓글 수: 2

thank you very much, I see where the trouble stems from!
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2022년 5월 13일

댓글:

2022년 5월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by