MATLAB How to do a double integral on matlab?

AI Thread Summary
The discussion centers on performing a double integral calculation in MATLAB for the function xy/(xy^2 + 1)^2 over a specified region. The user provided their MATLAB code but encountered issues with execution. Clarifications were requested regarding the integral's notation and the limits of integration. It was noted that the user initially misrepresented the integral, but later confirmed that the function definition was correct. The main focus is on ensuring the proper syntax and understanding of the integral's boundaries for successful computation in MATLAB.
Lucas94
Messages
7
Reaction score
0
Hey! I want to do a double integral calculation of this problem##∫∫ xy/(xy^2 +1)^2##

over the region bounded by 2 ≤ x ≤ 3 and 2*sqrt(1+x) ≤ y ≤ 2*sqrt(2+4x)
on MATLAB and i have tried the following syntax:

clc

clear all

fun=@(x,y) x*y./((x*y.^2+1).^2);

ymax=@(x) 2*sqrt(2+4*x);
q=integral2(fun,2,3,2*sqrt(1+x),ymax);But its doesn't work, can someone see what I am doing wrong?
 
Last edited:
Physics news on Phys.org
Lucas94 said:
Hey! I want to do a doubble integral calculation on MATLAB and i have tried the following syntax:

clc

clear all

fun=@(x,y) x*y./((x*y.^2+1).^2);

ymax=@(x) 2*sqrt(2+4*x);
q=integral2(fun,2,3,2*sqrt(1+x),ymax);But its doesn't work, can someone see what I am doing wrong?
It's not clear which double (only one 'b' in double) integral you are trying to evaluate.

If you would provide the actual integral using calculus notation, that would be a big help. Also, specify the region of integration or the limits, as required.
 
SteamKing said:
It's not clear which double (only one 'b' in double) integral you are trying to evaluate.

If you would provide the actual integral using calculus notation, that would be a big help. Also, specify the region of integration or the limits, as required.
##∫ ∫ xy/(xy^2 +1)^2##

over the region bounded by 2 ≤ x ≤ 3 and 2*sqrt(1+x) ≤ y ≤ 2*sqrt(2+4x)
 
Last edited:
Lucas94 said:
##∫ ∫ xy/(xy^2 +1)##

over the region bounded by 2 ≤ x ≤ 3 and 2*sqrt(1+x) ≤ y ≤ 2*sqrt(2+4x)

The denominator of the integrand above is (xy2 + 1)

Lucas94 said:
clc

clear all

fun=@(x,y) x*y./((x*y.^2+1).^2);

ymax=@(x) 2*sqrt(2+4*x);

In the definition fun above, the denominator appears to be (xy2 + 1)2. See the difference?
 
SteamKing said:
The denominator of the integrand above is (xy2 + 1)
In the definition fun above, the denominator appears to be (xy2 + 1)2. See the difference?
My bad i forgot to write it on the integrand , the denominator should be ##(xy^2 + 1)^2## soo my definition of fun is correct
 

Similar threads

Replies
4
Views
1K
Replies
8
Views
2K
Replies
2
Views
3K
Replies
6
Views
2K
Replies
2
Views
2K
Back
Top