Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Integrating f(x,y) on a certain line in XY plane
Date: Sun, 8 May 2011 21:09:07 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 44
Message-ID: <iq70pj$2o7$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> <iq704t$1av$1@newscl01ah.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
NNTP-Posting-Host: www-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1304888947 2823 172.30.248.48 (8 May 2011 21:09:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 8 May 2011 21:09:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:725760

"Mohamed Nasr" wrote in message <iq704t$1av$1@newscl01ah.mathworks.com>...
> "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

There is nothing in what I did that relied on symmetry,
except that I chose something simple to evaluate for
demonstration purposes.

As long as you can evaluate a function at any point
on the line, absolutely nothing stops you from doing
exactly as I did. Admittedly, your function is not going
to be possible to do in symbolic terms.

John