Integration takes time too long

조회 수: 26 (최근 30일)
Nurul Afrina
Nurul Afrina 2022년 6월 8일
댓글: Nurul Afrina 2022년 6월 8일
Hi, i want to integrate this equation C(x,y,t) but it takes too long and I did not get the solution . What can I do ?
This is my code that I have try
x=-2:1:6;
y=0.4;
t=0.75;
v=1.5;
alpha=0.1;
gamma=1/(1-alpha);
syms r;
A=exp(v/2*(x+y)-alpha*gamma*t);
B=(r^3)/(r.^2+gamma+v^2/2)^2;
D=exp((alpha*gamma.^2*t)/(r.^2+gamma+v^2/2));
K=besselj(0,r*sqrt(x.^2+y.^2));
L=besselj(2,r*sqrt(x.^2+y.^2));
M=B*D.*(K+L);
C=(alpha*(gamma^2)*y*A).*int(M,r,0,inf);
plot(x,C)

채택된 답변

Torsten
Torsten 2022년 6월 8일
X=-2:0.1:6;
y=0.4;
t=0.75;
v=1.5;
alpha=0.1;
for i=1:numel(X)
x = X(i);
Fun = @(r)fun(r,x,y,t,v,alpha);
C(i) = integral(Fun,0,Inf);
end
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 5.9e-09. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 6.5e-09. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 6.7e-09. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 7.1e-09. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 7.4e-09. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 8.1e-09. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 8.3e-09. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 9.4e-09. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 9.7e-09. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.0e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.1e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.2e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.2e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.3e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.4e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.6e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.6e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.7e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 1.9e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 2.0e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 2.2e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 2.3e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 2.4e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 2.6e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 2.8e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 3.0e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on error is 3.2e-08. The integral may not exist, or it may be difficult to approximate numerically to the requested accuracy.
plot(X,C)
function value = fun(r,x,y,t,v,alpha)
gamma=1/(1-alpha);
A=exp(v/2*(x+y)-alpha*gamma*t);
B=(r.^3)./(r.^2+gamma+v^2/2).^2;
D=exp((alpha*gamma.^2*t)./(r.^2+gamma+v^2/2));
K=besselj(0,r.*sqrt(x.^2+y.^2));
L=besselj(2,r.*sqrt(x.^2+y.^2));
M=B.*D.*(K+L);
value = alpha*gamma^2*y*A*M;
end

추가 답변 (1개)

SALAH ALRABEEI
SALAH ALRABEEI 2022년 6월 8일
Matlab is not good enough to symoblically ( analyitcally) integarate or solve such complex equations). If you want the the analytical integaration, it is better to simplify it yourslf by hand. However, you integarte (numerical approximation) over a truncated domain from [0, infinity) to [0, M], where M is a large number. This approached is already done by @Torsten here
  댓글 수: 1
Nurul Afrina
Nurul Afrina 2022년 6월 8일
Alright noted. Thank you for your explanation sir .

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

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by