help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plotting a function of 3 variables ?


From: Mike Miller
Subject: Re: Plotting a function of 3 variables ?
Date: Wed, 25 Apr 2012 08:00:33 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Apr 25, 2012 at 12:49:24PM +0100, Oisín Ó Cuanacháin wrote:
> I'm afraid, as with the other responses, you think wrong.
> 
> The mesh function plots surfaces (functions of TWO variables) in 3-D space
> with the colormap determining the colour of the surface. I want to plot a
> function of THREE variables ie. a rectangular lattice of points in 3-space
> with the colours of the lattice points indicating the value of the
> function.
> 
> This really isn't that complicated a concept, surely there must be someone
> on the list who understands what I am trying to do even it they don't know
> how to achieve it ?

Yes, you want a 3-dimensional view of a 4-d plot, where the color
represents the 4th axis.

I don't think the plot routines do this currently, but I just came up
with something, without colors, that may get you started.  This just
plots a marker at every integer intersection of the L+1 cube.  The
scatter3 function takes a color argument so it's just a matter of
filling that in for your z levels.

  L = 3;
  [x, y] = meshgrid(0:L, 0:L);
  for k = 1:(L+1)
    z(:,:,k) = (k-1)*ones(L+1);
  end
  for k = 1:(L+1)
    scatter3(x, y, z(:,:,k), 20);
    hold on;
  end

-- 
mike


reply via email to

[Prev in Thread] Current Thread [Next in Thread]