How to do a double integral on matlab?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 5K views
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