Matlab keeps being "busy" when computing the integral of a function
이전 댓글 표시
Hello guys,
I'm having a problem running a very simple code and I cannot figure out why.
The code is to find the definite integral of a function whose coefficients are variant. One limit of the integral is also variant.
I have quite a few computations to make but I started with the first two.
syms g z
[a,b] = meshgrid(1.2:.02:1.36,0.54:.02:0.6);
k = ((a./b)+((a./b).^2-4).^(1/2))./(2*a);
for i = 1:1
for j = 1:2
g =(a(i,j)*z)^2/(1+(a(i,j)*z)^2)-b(i,j)*z;
c(i,j) = int(g, z, 0, k(i,j));
end
end
For i=1, j=1, the code works fine but for i=1, j=2, it takes like forever for Matlab to compute. I have to use ctrl+c to stop it.
I don't see any singular behaviours of the function in the interval of integration.
I'm using Matlab R2014a. Maybe there are some stupid errors in the code but for the moment I cannot see it.
Could anyone find the problem?
Thank you!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Code Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!