Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: Integrating f(x,y) on a certain line in XY plane Date: Sun, 8 May 2011 20:58:05 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 32 Message-ID: <iq704t$1av$1@newscl01ah.mathworks.com> References: <iq5tkg$j6e$1@newscl01ah.mathworks.com> <iq5vo1$nch$1@newscl01ah.mathworks.com> <iq6390$17d$1@newscl01ah.mathworks.com> <iq6t1h$ocu$1@newscl01ah.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: www-02-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1304888285 1375 172.30.248.47 (8 May 2011 20:58:05 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sun, 8 May 2011 20:58:05 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 2733406 Xref: news.mathworks.com comp.soft-sys.matlab:725758 "Roger Stafford" wrote in message <iq6t1h$ocu$1@newscl01ah.mathworks.com>... > "John D'Errico" <woodchips@rochester.rr.com> wrote in message <iq6390$17d$1@newscl01ah.mathworks.com>... > > > "Mohamed Nasr" wrote in message <iq5tkg$j6e$1@newscl01ah.mathworks.com>... > > > > Dear all, > > > > I need to integrate f(x,y) on a line joining the 2 points (x1,y1) and (x2,y2) those points are known of course. so we are integrating f(x,y) on dl and the limits of integration are 2 points in XY plane which are (x1,y1) and (x2,y2).... > > > > I failed to find something which does this in matlab functions (quad(s) and int) Does anyone know how to do it? > > > > > > > > Thanks in advance > > ........ > > sympoly T > > PofT = P0 + (P1 - P0)*T; > > defint(sum(PofT.^2),'T',[0 1]) > > ans = > > 38.6666666666667 > > Simple either way. > > John > - - - - - - - - - - - > In taking John's advice you need to be careful what variable you wish to integrate with respect to. Your statement that "we are integrating f(x,y) on dl" is suggestive that you actually intend to integrate with respect to the distance measured along the line between the two points rather than John's 't' parameter. In that case you need to multiply your f(x,y) by dl/dt where 'l' is distance and 't'is John's parameter. This would give an answer of > > 172.9225903 > > for John's line integral. > > Roger Stafford Thanks John and Roger for your replies. Regarding John's advice, John,you used a symmetric function...How can you apply your theory on the following function: f(x,y)=log(abs(sqrt((XM-X).^2+(YM-Y).^2))). and XMID1 and YMID1 are known functions while X,Y are the variables to be integrated on the line connecting 2 points (X1,Y1) and (X2,Y2)...this line has the infinitesmal element dl. Waiting your reply