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

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

 Accepted 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 .

3 Comments

Hi Walter,
Thanks for the reply. The limits are defined based on the picture shown below (taken from https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2242761/pdf/main.pdf)
and the method I utilised was based on the thread:
The integral of interest is symbolic and the final output which I am interested is in terms of s and t (and x and y).
I have tried defining for loops for the values of s and t so that on each iteration the limits become numeric. But that still doesn't make too much sense to me since it strays far away from what is shown in the picture.
I must admit I'm quite a noob since I usually rely on my hands and brain to calculate an integral but they don't seem to work for this problem and I had to switch to matlab.
As I mentioned previously, the code and the picture are interchanged variable name wise and I am integrating over x and y with s and t as the variables used in the limits.
I do recieve a numeric answer correctly when I perform what you have suggested, however I am interested in a symbolic answer
syms a_R x y M EI real %warning: it might not be true that they are real!
Pi = sym('pi');
l1 = x/a_R - 1/2; l2 = x/a_R + 1/2;
l3 = y/a_R - 1/2; l4 = y/a_R + 1/2;
uz = a_R^2 * 3*M / (4*Pi*EI) * int(int((x/a_R - s)/sqrt(s^2+t^2), t, l3, l4),s,l1,l2)
uzs = simplify(uz, 'steps', 100)
This does not involve integrating over x and y, because the uz equation only has x and y as the bounds of integration. The result will, though, be in terms of x and y
The result has a lot of conditional parts because your sqrt(s^2+t^2) can be 0 as we have no reason to know that x/a_R and y/a_R cannot be in the range [-1/2, +1/2]

Sign in to comment.

More Answers (0)

Products

Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!