[R] vector field from a 3D scalar field

David Winsemius dwinsemius at comcast.net
Fri Mar 22 01:17:21 CET 2013


On Mar 21, 2013, at 4:40 PM, Waichler, Scott R wrote:

> I have a 3D field of a scalar variable (x, y, z, value).  Is there a way to generate a vector field from this data--gradient at defined points?  I found the rasterVis package for 2D data, but as yet nothing for 3D data.

Can't you just think of 'value' as a "potential" and then differentiate (using sweep?) along the three principal axes to construct the partial derivatives (eg. diff(value)/diff(x) at constant y and z)  which would then form the components of the vector field? That's how one goes from gravitational or electrical potential to the corresponding vector fields. E <- grad(V),

As always: Data would help clarify.

-- 
David Winsemius
Alameda, CA, USA



More information about the R-help mailing list