[scilab-Users] About 3D vector field plot

Samuel Gougeon Samuel.Gougeon at univ-lemans.fr
Wed Aug 17 13:12:35 CEST 2011


Hello Jorge,

Jorge Ortega <jortega at cactus.iico.uaslp.mx> a écrit :

> Hi Scilab
>
> I am inexperienced in the use of the software Scilab.  but I need to draw a
> vector field in 2 dimension and 3 dimension. How I can do this?

With xarrows(). xarrows() supports only X & Y coordinates as input parameters,
but the "data" field of the related handle e = gce(); e.data  supports  
a Z input.
You can run and adapt the following script as an example.
Regards
Samuel

----------------------------
// 3D arrowed helix with xarrows()

// Yielding data (coordinates):
N = 100;
Ntours = 2;
zi = linspace(-1,2,N);
zf = zi;
theta = (zi - min(zi))/(max(zi)-min(zi))*Ntours*360;
xi = zeros(1,N);
xf = cosd(theta);
yi = zeros(1,N);
yf = sind(theta);

// Displaying the system of axes (xarrows() does not do it):
clf, plot3d([-1 1 1 1],[-1 -1 -1 1],[-1 -1 2 2])
// Plotting the helix:
xarrows([xi;xf],[yi;yf],0.7)    // X & Y
e = gce();    // Setting Z by hand:
e.data(1:2:$,3) = zi.';
e.data(2:2:$,3) = zf.';





More information about the users mailing list