I wanted to solve a parametric double integral. Matlab requires me to set these parameters (for my case x0, x1, x2, x3, x4, x5, x6, x7, x8 and x9). The variables are r and t. Is there a solution with Matlab to solve a double integral set without sett

I wanted to solve a parametric double integral. Matlab requires me to set these parameters (for my case x0, x1, x2, x3, x4, x5, x6, x7, x8 and x9).
The variables are r and t.
Is there a solution with Matlab to solve a double integral set without setting any values of the parameters.
here is the code:
------------------------------------
syms t r x0 x1 x2 x3 x4 x5 x6 x7 x8 x9;
tmin = 0;
tmax = 1;
rmin = 0;
rmax = 2*pi;
g = +(x0*cos(-2*t)-x5*sin(-2*t))*(1-r^(-2))+(x1*cos(-1*t) - x6*sin(-1*t))*(1-r^(-1))+(x2*cos(0*t)-x7*sin(0*t))*(1-r^(0))+(x3*cos(1*t)-x8*sin(1*t))*(1-r^(1))+(x4*cos(2*t)-x9*sin(2*t))*(1-r^(2));
h = +(x0*sin(-2*t)+x5*cos(-2*t))*(1-r^(-2))+(x1*sin(-1*t)+x6*cos(-1*t))*(1-r^(-1))+(x2*sin(0*t)+x7*cos(0*t))*(1-r^(0))+(x3*sin(1*t)+x8*cos(1*t))*(1-r^(1))+(x4*sin(2*t)+x9*cos(2*t))*(1-r^(2));
f = r*(g^2+h^2);
fun = @(t,r) f;
format long
J = integral2(fun,tmin,tmax,rmin,rmax,'Method','iterated','AbsTol',1e-12 ,'RelTol',1e-10)
---------------end-------------------
thank you in advance

 채택된 답변

You are already using syms so you have the symbolic toolbox. Use int() to do the integration.
int(int(f, t, tmin, tmax), r, rmin, rmax)
The result cannot be a numeric value because of the free variables.
Note: the solution is going to be +/- infinity depending on the value of some of the x* coefficients, because you have r^(-2) and 0 is in the range of r: you have singularities in your integral.

추가 답변 (1개)

thank you for the answer. That works now.... I see that the value will be +/- infinity depending on the value of x0,...,x9. I have to check the expression. I have a sum which varies from -n to n, with n = 2. Due to the singularities, I have to change the expression from 0 to 2n + 1. thank you for everything

댓글 수: 4

Maple says that the result of what you originally posted will be
signum((1/2)*x0^2+(1/2)*x5^2)*infinity
which turns out to depend only on x0 and x5
I change the first value in the sum (from 0 to N=5), but I can't obtained a value. I don't known what is the problem.
Here is the code:
-------------------------
syms t r x0 x1 x2 x3 x4 x5 x6 x7 x8 x9;
tmin = 0;
tmax = 2*pi;
rmin = 0;
rmax = 1;
g = +(x0*cos(0*t)-x5*sin(0*t))*(1-r^(0))+(x1*cos(1*t)-x6*sin(1*t))*(1-r^(1))+(x2*cos(2*t)-x7*sin(2*t))*(1-r^(2))+(x3*cos(3*t)-x8*sin(3*t))*(1-r^(3))+(x4*cos(4*t)-x9*sin(4*t))*(1-r^(4));
h = +(x0*sin(0*t)+x5*cos(0*t))*(1-r^(0))+(x1*sin(1*t)+x6*cos(1*t))*(1-r^(1))+(x2*sin(2*t)+x7*cos(2*t))*(1-r^(2))+(x3*sin(3*t)+x8*cos(3*t))*(1-r^(3))+(x4*sin(4*t)+x9*cos(4*t))*(1-r^(4));
f = r*(g^2+h^2);
fun = @(t,r) f;
J = int(int(fun,t,tmin,tmax),r,rmin,rmax)
-----------------------
can you have any idea for that.
thank on advance.
Although the result, J, shows up in terms of int(), if you simplify(J) then the closed form solution is returned.
it works well now. thank you for the indication.

댓글을 달려면 로그인하십시오.

카테고리

태그

질문:

2016년 9월 15일

댓글:

2016년 9월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by