Calculating double integral of a single variable

17 vues (au cours des 30 derniers jours)
Manan
Manan le 26 Jan 2013
Commenté : Mike Hosea le 18 Fév 2015
I want to calculate the double integral int [E1,E2] ( f(x) * {int [E1,x] (g*dy)} * dx)
I am trying to solve this integral by breaking it into two ode's and then solving the ode's simultaneously using ode45 but I am not sure if this is the correct way to solve this integral.
Can anyone suggest me if I am doing it correctly or is there any other way to do it?
Thanks.
  2 commentaires
Roger Stafford
Roger Stafford le 26 Jan 2013
No, I don't think that is valid. Solving a double integral with respect to two different variables x and y could be done by solving a particular kind of partial differential equation with boundary conditions corresponding to the integration limits, but that would not in general be an easier solution. It is better to solve double integrals using the tools that have been designed for that purpose.
Roger Stafford
Roger Stafford le 26 Jan 2013
I'll have to modify my previous statement. If the g integrand in your expression is a function only of y, then you could solve your double integral as the solution of an ordinary differential equation. If g also depends on x I think you're out of luck.

Connectez-vous pour commenter.

Réponses (2)

Mike Hosea
Mike Hosea le 28 Jan 2013
Three ways:
integral2(@(x,y)f(x).*g(x,y),E1,E2,E1,@(x)x)
integral(@(x)f(x).*integral(@(y)g(x,y),E1,x),E1,E2,'ArrayValued',true)
integral(@(x)f(x).*arrayfun(@(x)integral(@(y)g(x,y),E1,x),x),E1,E2,'ArrayValued',true)
Things simplify just slightly if g is only a function of y.

Muhammad Danish
Muhammad Danish le 18 Fév 2015
Hi Mike Hosea, I have been following your posts to find a solution to my problem but not yet able to solve it yet.
I want to integrate a pressure equation to get the hydrodynamic bearing forces. the way I am doing it is as follows: function [forceR,forceT]=forces(eps,epsd,dalfa,ombar)
c=0.0001; Rb=0.024; Rj=Rb-c; Lb=0.02; u=0.01;
del0=(atan(epsd/(eps*(ombar-dalfa)))); del1=del0+pi;
z0=0; z1=z0-(Lb/2); z2=z0+(Lb/2);
%Pr=(((6.*u.*c)./((c.*(1+eps.*cos(del0))).^3)).*((epsd.*cos(del0))+(eps.*(dalfa-ombar).*sin(del0))).*((z0.^2)-(0.25*(Lb^2))));
fun1 = @(del,z)((((6.*u.*c)./((c.*(1+eps.*cos(del))).^3)).*((epsd.*cos(del))+(eps.*(dalfa-ombar).*sin(del))).*((z.^2)-(0.25*(Lb^2)))).*cos(del)); fun2 = @(del,z)((((6.*u.*c)./((c.*(1+eps.*cos(del))).^3)).*((epsd.*cos(del))+(eps.*(dalfa-ombar).*sin(del))).*((z.^2)-(0.25*(Lb^2)))).*sin(del));
forceR=-integral2(fun1,del0,del1,z1,z2)*Rb; forceT=-integral2(fun2,del0,del1,z1,z2)*Rb;
end
fun1 and fun 2 are dependent on del and z and the upper and lower limits are from del0 to del1 and z1-z2.
this is an embedded function in a simulink model. (coder.extrinsic).
The program starts running then give me an error when the simulation reaches 2-3 percent.
I shall be really grateful if anyone of you could help me in this.
Regards Danish
  1 commentaire
Mike Hosea
Mike Hosea le 18 Fév 2015
I found your question. I will comment there.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by