From help-octave-request at bevo dot che dot wisc dot edu Fri Feb 2 07:11:10 2001 Subject: Re: plotting in 3D From: Paul Kienzle To: Ben Sapp Cc: courtois at ensia dot inra dot fr, help-octave@bevo.che.wisc.edu Date: Thu, 1 Feb 2001 14:25:43 +0000 In matcompat I have plot3(x,y,z,'fmt'). Maybe you want plot3(A(:,1), A(:,2), A(:,3), '^') which puts spikes of height A(i,3) at [A(i,1),A(i,2)]. http://users.powernet.co.uk/kienzle/octave/matcompat Paul Kienzle pkienzle at kienzle dot powernet dot co dot uk On Thu, Feb 01, 2001 at 09:44:43AM -0700, Ben Sapp wrote: > courtois at ensia dot inra dot fr wrote: > > > > On 1 Feb, Etienne Grossmann wrote: > > > > > > Hello, > > > > > > From: courtois at ensia dot inra dot fr > > > # Hi > > > # > > > # I don't understand how to plot in 3d a matrix (30 x 3). I read > > > # sombrero.m but in my case the mesh is partial, and the "gset > > > # parametrics" is ununderstandable. > > > # > > > # any help ? > > > > > > What about : > > > > > > octave:361> [x, y] = meshgrid (linspace (-10,10,30),linspace (-10,10,30)); > > > octave:362> z = sin (x) + y.^2/100; > > > octave:363> mesh (x, y, z) > > > > the problem is that I have already x y z in a matrix. So I don't have a > > complete mesh. I have difficulties to explain myself in english. In fact > > x y z (in matrix A) is partial experimental design with results in > > column z > > Do I understand correctly that you actually want a 3-d trajectory and > not a mesh? A mesh is only good for a surface. If that is the case > then I think I have solved this exact problem a few months back. The > function I wrote does no type checking what so ever. I wrote it because > I needed to plot the trajectory of a differential equation. > You may need to transpose your matrix if the dimensions don't agree with > what the function expects. It expects x to be in the first column, y in > the second column, z in the third column. > > The Function: > ------------------------------------------------------ > function plot3d(x) > name = tmpnam(); > [id,msg] = fopen(name,"w"); > for i = 1:(size(x)(1)) > fprintf(id, "%f %f %f\n",x(i,1),x(i,2),x(i,3)); > endfor > fflush(name); > cmd = sprintf("gsplot \"%s\"\n",name); > eval(cmd); > fclose(name); > endfunction > -------------------------------------------------------- > > Good luck. > > -- > Ben Sapp Los Alamos National Laboratory > email: Phone: (505)667-3277 > Fax: (505)665-7920 URL: http://www.neutrino.lanl.gov/ > -- > > > > ------------------------------------------------------------- > Octave is freely available under the terms of the GNU GPL. > > Octave's home on the web: http://www.octave.org > How to fund new projects: http://www.octave.org/funding.html > Subscription information: http://www.octave.org/archive.html > ------------------------------------------------------------- > > ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------