MATLAB: Double integration using the Symbolic Toolbox (No error but no answer either)

double integrationintegrationmathematicsMATLABsymbolicSymbolic Math Toolboxtoolbox

Hello,
I am currently trying to solve a double integration of the form shown in the picture below. In the code, the integrand is solved with respect to x and y while s and t are variables. Hence the final output should be in terms of s and t only (this is opposite to the picture). The limits are a function of s and t as well.
clear all
syms s t x y
fun = @(x,y) 3*10^-8*((s*10^-6)/(176*10^-6)-x)/sqrt(x^2+y^2);
xmax = @(s) ((s/176) +0.5);
xmin = @(s) ((s/176) -0.5);
ymax = @(t) ((t/427) +0.5);
ymin = @(t) ((t/427) -0.5);
final = vpaintegral(vpaintegral(fun, x, xmin, xmax), y, ymin, ymax);
There is no error in the code, however I receive no viable output, just this
final =
vpaintegral(vpaintegral(((1133367955888715*s)/6649092007880460460883968 - (1133367955888715*x)/37778931862957161709568)/(x^2 + y^2)^(1/2), x, s/176 - 1/2, s/176 + 1/2), y, t/427 - 1/2, t/427 + 1/2)
Can somebody guide me towards what I am doing wrong, I feel like I'm making a silly mistake somewhere

Best Answer

You are doing a double integration on a function coded with at least 3 variables -- s, x, y . vpaintegral() can only produce a numeric value when the number of variables is no more than the number of integrations done.
For clarity, do not define your function in terms of the variables x and y when you will be integrating over s and t -- especially not when x appears in the formula.
Your boundaries do not seem to make a lot of sense. Your expression is written as if l1, l2, l3, l4 are all constants, but your bounds for integration are written as if they are expressions.
I recommend just constructing straight-forward transcription of the formula, possibly with all symbolic variables, and then after that if you have particular numeric bounds you can substitute them in. Adding assumptions to the variables can help, especially with regards to whether any of l1, l2, l3, l4 can be -1 or 0 or +1 .