Matlab keeps being "busy" when computing the integral of a function
Afficher commentaires plus anciens
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!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Code Performance dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!