From: Zim on 20 Jun 2010 12:24 Hi Everyone I am trying to integrate a region which sort of ellispe. I am using dblquad to do so where inner limits are function of outer limits as follows. But I am getting error that x1 is undefined @dblquad (const = constant) F = @(x1,x2)((1 ./ (2 .* pi .* const .* const)) .* (exp((-0.5) .* ((((x1 - const).^ 2) ./ const ) + (((x2 - const) .^ 2) ./ const ))))); dblquad(F,x_L,x_H,y1,y2) y1 = (-const - (sqrt((const .^ 2 ) - (4 .* const .* ((cont .* (x1 .^ 2)) + (const .* x1) + const))))) ./ (2 .* C); y2 = (-const - (sqrt((const .^ 2 ) + (4 .* const .* ((cont .* (x1 .^ 2)) + (const .* x1) + const))))) ./ (2 .* const); thanks in advance, JA
From: John D'Errico on 20 Jun 2010 12:47 "Zim " <abraham_john_love(a)yahoo.com> wrote in message <hvlfb4$i7b$1(a)fred.mathworks.com>... > Hi Everyone > I am trying to integrate a region which sort of ellispe. I am using dblquad to do so where inner limits are function of outer limits as follows. But I am getting error that x1 is undefined @dblquad > (const = constant) > > F = @(x1,x2)((1 ./ (2 .* pi .* const .* const)) .* (exp((-0.5) .* ((((x1 - const).^ 2) ./ const ) + (((x2 - const) .^ 2) ./ const ))))); > dblquad(F,x_L,x_H,y1,y2) > > > y1 = (-const - (sqrt((const .^ 2 ) - (4 .* const .* ((cont .* (x1 .^ 2)) + (const .* x1) + const))))) ./ (2 .* C); > > y2 = (-const - (sqrt((const .^ 2 ) + (4 .* const .* ((cont .* (x1 .^ 2)) + (const .* x1) + const))))) ./ (2 .* const); > > thanks in advance, > JA The problem is that dblquad does not allow problems where the limits vary as a function of the other variable. Sometimes you can transform a problem with variable limits into one with fixed, constant limits. If not, then you cannot use dblquad for this problem. John
From: Ravi on 20 Jun 2010 21:42 Hi JA, Yes John is correct - dblquad (and most integration functions) can only integrate over a rectangular region (fixed limits). You will have to transform your curvilinear problem to a rectangular problem. integral[f(x,y)*dx*dy] = integral[|J|* f(x(u,v),y(u,v)*du*dv] |J|=absolute value of Jacobian determinant J J=del(x)/del(u)*del(y)/del(v) - del(x)/del(v)*del(y)/del(u) LH integral is your original integral with variable limits. RH integral is the transformed integral with fixed limits which u can use with dblquad. If your region is an ellipse, use the following transformation x=a*v*cos(u) y=b*v*sin(u) a,b=semi major/minor axis of ellipse This will give Jacobian J=a*b*v And the integration limits as 0<=u<=2*pi 0<=v<=1 Now you can use dblquad ! Ravi "Zim " <abraham_john_love(a)yahoo.com> wrote in message <hvlfb4$i7b$1(a)fred.mathworks.com>... > Hi Everyone > I am trying to integrate a region which sort of ellispe. I am using dblquad to do so where inner limits are function of outer limits as follows. But I am getting error that x1 is undefined @dblquad > (const = constant) > > F = @(x1,x2)((1 ./ (2 .* pi .* const .* const)) .* (exp((-0.5) .* ((((x1 - const).^ 2) ./ const ) + (((x2 - const) .^ 2) ./ const ))))); > dblquad(F,x_L,x_H,y1,y2) > > > y1 = (-const - (sqrt((const .^ 2 ) - (4 .* const .* ((cont .* (x1 .^ 2)) + (const .* x1) + const))))) ./ (2 .* C); > > y2 = (-const - (sqrt((const .^ 2 ) + (4 .* const .* ((cont .* (x1 .^ 2)) + (const .* x1) + const))))) ./ (2 .* const); > > thanks in advance, > JA
From: Zim on 21 Jun 2010 04:46 Thanks a lot ravi.. "Ravi " <soni_romi(a)yahoo.com.thisisjunkremoveit> wrote in message <hvmg1d$30q$1(a)fred.mathworks.com>... > Hi JA, > > Yes John is correct - dblquad (and most integration functions) can only integrate over a rectangular region (fixed limits). > > You will have to transform your curvilinear problem to a rectangular problem. > > integral[f(x,y)*dx*dy] = integral[|J|* f(x(u,v),y(u,v)*du*dv] > > |J|=absolute value of Jacobian determinant J > > J=del(x)/del(u)*del(y)/del(v) - del(x)/del(v)*del(y)/del(u) > > LH integral is your original integral with variable limits. > > RH integral is the transformed integral with fixed limits which u can use with dblquad. > > > If your region is an ellipse, use the following transformation > > x=a*v*cos(u) > > y=b*v*sin(u) > > a,b=semi major/minor axis of ellipse > > This will give Jacobian J=a*b*v > > And the integration limits as > 0<=u<=2*pi > 0<=v<=1 > > Now you can use dblquad ! > > Ravi > > > "Zim " <abraham_john_love(a)yahoo.com> wrote in message <hvlfb4$i7b$1(a)fred.mathworks.com>... > > Hi Everyone > > I am trying to integrate a region which sort of ellispe. I am using dblquad to do so where inner limits are function of outer limits as follows. But I am getting error that x1 is undefined @dblquad > > (const = constant) > > > > F = @(x1,x2)((1 ./ (2 .* pi .* const .* const)) .* (exp((-0.5) .* ((((x1 - const).^ 2) ./ const ) + (((x2 - const) .^ 2) ./ const ))))); > > dblquad(F,x_L,x_H,y1,y2) > > > > > > y1 = (-const - (sqrt((const .^ 2 ) - (4 .* const .* ((cont .* (x1 .^ 2)) + (const .* x1) + const))))) ./ (2 .* C); > > > > y2 = (-const - (sqrt((const .^ 2 ) + (4 .* const .* ((cont .* (x1 .^ 2)) + (const .* x1) + const))))) ./ (2 .* const); > > > > thanks in advance, > > JA
From: Zim on 21 Jun 2010 04:56 thanks a lot john..:) "Zim " <abraham_john_love(a)yahoo.com> wrote in message <hvn8sg$9ne$1(a)fred.mathworks.com>... > Thanks a lot ravi.. > > "Ravi " <soni_romi(a)yahoo.com.thisisjunkremoveit> wrote in message <hvmg1d$30q$1(a)fred.mathworks.com>... > > Hi JA, > > > > Yes John is correct - dblquad (and most integration functions) can only integrate over a rectangular region (fixed limits). > > > > You will have to transform your curvilinear problem to a rectangular problem. > > > > integral[f(x,y)*dx*dy] = integral[|J|* f(x(u,v),y(u,v)*du*dv] > > > > |J|=absolute value of Jacobian determinant J > > > > J=del(x)/del(u)*del(y)/del(v) - del(x)/del(v)*del(y)/del(u) > > > > LH integral is your original integral with variable limits. > > > > RH integral is the transformed integral with fixed limits which u can use with dblquad. > > > > > > If your region is an ellipse, use the following transformation > > > > x=a*v*cos(u) > > > > y=b*v*sin(u) > > > > a,b=semi major/minor axis of ellipse > > > > This will give Jacobian J=a*b*v > > > > And the integration limits as > > 0<=u<=2*pi > > 0<=v<=1 > > > > Now you can use dblquad ! > > > > Ravi > > > > > > "Zim " <abraham_john_love(a)yahoo.com> wrote in message <hvlfb4$i7b$1(a)fred.mathworks.com>... > > > Hi Everyone > > > I am trying to integrate a region which sort of ellispe. I am using dblquad to do so where inner limits are function of outer limits as follows. But I am getting error that x1 is undefined @dblquad > > > (const = constant) > > > > > > F = @(x1,x2)((1 ./ (2 .* pi .* const .* const)) .* (exp((-0.5) .* ((((x1 - const).^ 2) ./ const ) + (((x2 - const) .^ 2) ./ const ))))); > > > dblquad(F,x_L,x_H,y1,y2) > > > > > > > > > y1 = (-const - (sqrt((const .^ 2 ) - (4 .* const .* ((cont .* (x1 .^ 2)) + (const .* x1) + const))))) ./ (2 .* C); > > > > > > y2 = (-const - (sqrt((const .^ 2 ) + (4 .* const .* ((cont .* (x1 .^ 2)) + (const .* x1) + const))))) ./ (2 .* const); > > > > > > thanks in advance, > > > JA
|
Next
|
Last
Pages: 1 2 Prev: PsychToolBox Next: Assignment within State (syntax error in Stateflow) |