Path: news.mathworks.com!not-for-mail From: "yl " <shanshicn@hotmail.com> Newsgroups: comp.soft-sys.matlab Subject: Re: how to integrate a vector over a discrete surface? Date: Thu, 31 Mar 2011 18:48:05 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 41 Message-ID: <in2i95$8fp$1@fred.mathworks.com> References: <il3k7n$dqu$1@fred.mathworks.com> <il459e$opn$1@fred.mathworks.com> <il5gld$2oh$1@fred.mathworks.com> <il6873$mhm$1@fred.mathworks.com> <il952f$kmm$1@fred.mathworks.com> <iloh37$72n$1@ginger.mathworks.com> <ilon09$o2h$1@ginger.mathworks.com> <ilt2vo$7ms$1@ginger.mathworks.com> <iltbhd$726$1@ginger.mathworks.com> Reply-To: "yl " <shanshicn@hotmail.com> NNTP-Posting-Host: www-03-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1301597285 8697 172.30.248.48 (31 Mar 2011 18:48:05 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Thu, 31 Mar 2011 18:48:05 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 2771344 Xref: news.mathworks.com comp.soft-sys.matlab:719376 Roger, You are right and I have tested the codes on a flat circle. One question: does Green's theory or the code requires the boundary in one plane? Looks like it is true according to the assumptions of GREEN'S THEOREM. (1827) If F(x; y) = (P(x; y);Q(x; y)) is a vector field in the plane and R is a region in the plane which has as a boundary a piecewise smooth closed curve traversed in the direction so that the region R is "to the left"... For 3d case, if the boundary is not on one plane, will the same conclusion holds? thanks. "Roger Stafford" wrote in message <iltbhd$726$1@ginger.mathworks.com>... > "yl " <shanshicn@hotmail.com> wrote in message <ilt2vo$7ms$1@ginger.mathworks.com>... > > Roger, thanks for your reminding. i may not describe correctly last time and here is what I did: > > > > 1) define vector R (x,y,z) for each point(x,y,z) > > 2) define dR=diff(R) > > 3) Fi=cross(R,dR) and sum together for all points to get F > > 4) F has three components in x, y, z directions respectively, i.e., force components > > > > Rv0=[Rd.*cos(Td),Rd.*sin(Td),Zd];%transfer from polar system to (x,y,z) > > Rv=Rv0; > > dR=diff(Rv); > > Rv(1,:)=[]; > > s=0; > > for i=1:length(dT) > > s=s+cross(Rv(i,:),dR(i,:)); > > end > > > - - - - - - - - - - - - > Yes that looks right, provided that the first and last values in Rd, Td, and Zd represent the same point and provided that length(dT) is the same as length(dR). > > You could just write: > > s = sum(cross(Rv,dR,2),1); > > instead of the for-loop. > > Your second version isn't correct. You don't want dT(i) in there. That would make the answer a scalar and moreover vanishingly small with both dR and dT multiplied together. > > You can test your answer by running the boundary around a flat circle and see if your answer is (close to) the area of the circle. > > Roger Stafford