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 23:29:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 20
Message-ID: <iq7900$jj3$>
References: <iq5tkg$j6e$> <iq5vo1$nch$> <iq6390$17d$> <iq6t1h$ocu$> <iq704t$1av$> <iq740k$9e4$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1304897344 20067 (8 May 2011 23:29:04 GMT)
NNTP-Posting-Date: Sun, 8 May 2011 23:29:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2733406
Xref: comp.soft-sys.matlab:725772

"Roger Stafford" wrote in message <iq740k$9e4$>...
> "Mohamed Nasr" wrote in message <iq704t$1av$>...
> > ..........
> > 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
> - - - - - - - - - -
>   In the case of the function you have defined, Mohamed, there is an easily expressed analytic function which is the solution to your integral.  You don't need matlab's numerical integration at all to solve this problem, (except perhaps the symbolic toolbox for obtaining this integral solution.)
>   I will give an indefinite integral formula from my integral table textbook which could be used to derive the above solution in case you don't have the symbolic toolbox:
>  int(log(x^2+a^2)) = x*log(x^2+a^2) - 2*x + 2*a*atan(x/a) + C
> In your case the variable x here would represent the distance, l, measured along the line segment.  If you want help in this latter endeavor, please let us know.
> Roger Stafford

How will you tell matlab the coordinates of the line l in order to integrate on it?
Note that in this 2D problem I cannot just consider the length of the line of integration regardless of its position in space due to physics of problem. It is getting charge distribution on a contour which I already know its voltage so position of one part of body w.r.t. other part can totally change charge distribution...