Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: from gradient to field
Date: Fri, 21 Oct 2011 17:05:25 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 14
Message-ID: <j7s8ol$ppj$1@newscl01ah.mathworks.com>
References: <j7rue6$gsu$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1319216725 26419 172.30.248.46 (21 Oct 2011 17:05:25 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 21 Oct 2011 17:05:25 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:746713

"Arseny Kubryakov" <arskubr@gmail.com> wrote in message <j7rue6$gsu$1@newscl01ah.mathworks.com>...
> Right now I am working on reconstructing dynamic topography of the ocean from geostrophic currents. So in fact, I have one random field G that is the gradient of another random field S. 
> 
> How can I, using matlab, compute initial field from it's known gradient?
- - - - - - - - - - -
  Once you know the value of G at some particular point, you can find its value at any other point by taking the line integral of the given gradient along any path between the two points.  If G is truly a gradient, meaning that its curl must be identically zero, the line integral value will be independent of the path taken.

  This means you should be able to construct a two-dimensional G by first taking a cumulative integral of the gradient along some straight line containing the particular point, and then for each discrete point evaluated along this line, take a cumulative integral along an orthogonal line.  This would give you the value of G at a 2D mesh of points.  (Of course if you are working in three dimensions it will require one additional level of integration along the third dimension.)

  Matlab's 'cumtrapz' is such a cumulative integration function, or for higher order integration there are cumulative integration routines available in FEX.  For example I have one that does third order approximation at:

 http://www.mathworks.com/matlabcentral/fileexchange/19152

Roger Stafford