From: Vivek Saxena on 20 Mar 2010 03:00 But I think this will do, because this transforms the triangle into a right angled triangle in (u, v) space with the vertices (0, 0), (0, 1), and (1,1). Now I just have to write the integrand as f(x(u,v), y(u,v)), multiply it by the Jacobian factor, and integrate from u = 0 to 1 and v = 0 to u (and not v = 0 to 1). Is it possible to do this symbolically? That is, what we now have to do is \int_{u=0}^{u=1} \int_{v=0}^{v=u} g(u, v) du dv What limits does one specify to quad2d here?
From: Roger Stafford on 20 Mar 2010 03:33 "Vivek Saxena" <maverick280857(a)yahoo.com> wrote in message <ho1pvj$cbr$1(a)fred.mathworks.com>... > Thanks Roger. But didn't you mean > > x = (1-u)*x1 + u*[(1-v)*x2 + v*x3] > y = (1-u)*y1 + u*[(1-v)*y2 + v*y3] > > because the coordinate map you gave doesn't involve x1 and y1. But even so, this becomes a triangle in (u, v) space because > > u = 0, v = 0 => x = x1, y = y1 > u = 0, v = 1 => x = x1, y = y1 > u = 1, v = 0 => x = x2, y = y2 > u = 1, v = 1 => x = x3, y = y3 > > Only the last 3 coordinates are meaningful essentially, because if u = 0, the way this map is constructed, the value of v becomes meaningless. Perhaps you meant something else? You are quite right in your first assertion, Vivek. It was a typing error and should be as you say, x = (1-u)*x1 + u*((1-v)*x2 + v*x3) y = (1-u)*y1 + u*((1-v)*y2 + v*y3) However I disagree with your second statement. The interior of the triangle in x and y becomes the full interior of the unit square in u & v. At the far end the point (x1,y1) becomes stretched out to the line segment connecting (0,0) and (0,1) in u,v space. Just shy of (x1,y1) a very short strip in x,y space is stretched to the full unit length strip in u,v space. The transformation is valid because at the same time the Jacobian shrinks toward zero in compensation as you approach the point (x1,y1). Of course the inverse transformation from u,v to x,y becomes singular at that point but it doesn't matter in finding the double integral. It only means that dblquad will be a little wasteful in the number of points it uses toward the u = 0 end. If you doubt the above statement, try this: x1 = randn; y1 = randn; % Random vertices for triangle in x,y x2 = randn; y2 = randn; x3 = randn; y3 = randn; N = 2000; u = rand(1,N); % u & v fill the unit square in u,v space v = rand(1,N); x = (1-u)*x1 + u.*((1-v)*x2 + v*x3); % x and y will fill the triangle y = (1-u)*y1 + u.*((1-v)*y2 + v*y3); plot([x1,x2,x3,x1],[y1,y2,y3,y1],'r-',x,y,'y.') axis equal You will see that the red triangle becomes nicely filled up with yellow dots even though they become tightly packed toward the (x1,y1) vertex, (where the Jacobian is getting smaller.) Roger Stafford
From: Bruno Luong on 20 Mar 2010 03:36 "Vivek Saxena" <maverick280857(a)yahoo.com> wrote in message <ho1k5u$hsc$1(a)fred.mathworks.com>... > Hi, > > I'm wondering if it is possible to perform a double integral in MATLAB like > > \int \int f(x,y) dx dy > > where the domain of integration is a triangle, whose vertex coordinates are known? > > A full question is posted here: http://www.physicsforums.com/showthread.php?t=388101. It looks like a wave equation. Usually in FEM integration perform using Gaussian quadrature formula. On triangle, it involve barycentric coordinates. There are several schemes more or less complex and accurate. Very accurate integration such as QUAD2 is not necessary in FEM, but take a lot of time. Bruno
From: Roger Stafford on 20 Mar 2010 03:42 "Vivek Saxena" <maverick280857(a)yahoo.com> wrote in message <ho1rq8$8rk$1(a)fred.mathworks.com>... > But I think this will do, because this transforms the triangle into a right angled triangle in (u, v) space with the vertices (0, 0), (0, 1), and (1,1). > > Now I just have to write the integrand as f(x(u,v), y(u,v)), multiply it by the Jacobian factor, and integrate from u = 0 to 1 and v = 0 to u (and not v = 0 to 1). Is it possible to do this symbolically? That is, what we now have to do is > > \int_{u=0}^{u=1} \int_{v=0}^{v=u} g(u, v) du dv > > What limits does one specify to quad2d here? No Vivek, you should integrate over the full square u = 0 to u = 1 and v = 0 to v = 1. dblquad will not let you do otherwise. It is the full u,v square that the x,y triangle is mapped into by the given transformation. It does not matter that it has a singularity at the (x1,y1) vertex. Roger Stafford
From: Vivek Saxena on 20 Mar 2010 05:32 "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <ho1u8b$dfi$1(a)fred.mathworks.com>... > No Vivek, you should integrate over the full square u = 0 to u = 1 and v = 0 to v = 1. dblquad will not let you do otherwise. It is the full u,v square that the x,y triangle is mapped into by the given transformation. It does not matter that it has a singularity at the (x1,y1) vertex. > > Roger Stafford Hi Roger, I think I see your point. But what if I use quad2d? So, if I understand you correctly, the triangle is mapped to the square {(u,v): 0<= u <= 1, 0 <= v <= 1} in (u,v) space.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: How do I freeze the axes? Next: ARMA estimated value prediction |