plotting 3d discrete data



El mar, 07-04-2009 a las 13:30 -0500, Barton Willis escribi?:
> Let sol be a Maxima matrix. I'd like to plot the points [i * hx, j * ht, 
> sol[i,j]],
> where hx and ht are positive numbers (step sizes--for numerical methods 
> class, I'm 
> doing a finite difference method for the heat equation). I can do this via
> 
>   (%i89) f(x,t) := sol[round(x*nx),round(t * nt / t_final)];
>   (%i90) plot3d(f(x,t),[x,0,1],[t,0,t_final]);
> 
> but it's slow. What is the better way?
> 
> Barton

I have just commited a new graphic object (mesh) for package draw. Here
is the associated documentation:

@deffn  {Graphic object} mesh
(@var{mat}, at var{x0}, at var{y0}, at var{width}, at var{height})
Draws matrix @var{mat} in 3D space. @var{z} values are taken from
@var{mat},
the abscissas range from @var{x0} to @math{@var{x0} + @var{width}}
and ordinates from @var{y0} to @math{@var{y0} + @var{height}}.

This object is affected by the following @i{graphic options}:
@code{line_type},
@code{line_width}, @code{key}, @code{enhanced3d}, @code{meshed_surface}
and @code{color}.

This graphic object ignores @code{enhanced3d} values other than
@code{true} and @code{false}.

Example:

@example
(%i1) load(draw)$
(%i2) m: apply(
            matrix,
            makelist(makelist(random(10.0),k,1,30),i,1,20)) $
(%i3) draw3d(
         color = blue,
         mesh(m,0,0,3,2),
         xlabel = "x",
         ylabel = "y",
         surface_hide = true);
@end example

@end deffn

I can modify it to accept 2d arrays if necessary. I don't know if 'mesh'
is the right name for this object; if there are better ideas, I can
change it.

-- 
Mario