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$>
References: <j7rue6$gsu$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1319216725 26419 (21 Oct 2011 17:05:25 GMT)
NNTP-Posting-Date: Fri, 21 Oct 2011 17:05:25 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:746713

"Arseny Kubryakov" <> wrote in message <j7rue6$gsu$>...
> 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:

Roger Stafford