[25600] in Athena Bugs

home help back first fref pref prev next nref lref last post

linux 9.2.29: matlab

daemon@ATHENA.MIT.EDU (Omri Schwarz)
Wed Apr 14 20:33:19 2004

Message-Id: <200404150027.i3F0R7Z4007743@zygorthian-space-raiders.mit.edu>
To: bugs@mit.edu
Date: Wed, 14 Apr 2004 20:27:07 -0400
From: Omri Schwarz <ocschwar@mit.edu>
Errors-To: bugs-bounces@mit.edu

System name:		zygorthian-space-raiders.mit.edu
Type and version:	i686 9.2.29 (with mkserv)
Display type:		Matrox Graphics, Inc. MGA G400 AGP (rev 85)

Shell:			/bin/athena/tcsh
Window manager:		sawfish

What were you trying to do?
Do a proper three dimensional gradient 
using the numerical gradient function.

What's wrong:
a = zeros([5,5,5]); 
a(:,:,1)=1;
a(:,:,5)=-1;
[x,y,z]=gradient(a);

Look at x, y and z and everything is fine. 

a = zeros([5,5,5]); 
a(:,1,:)=1;
a(:,5,:)=-1;
[x,y,z]=gradient(a);

Look at x,y, and z and see that everything is NOT fine. 

a = zeros([5,5,5]); 
a(1,:,:)=1;
a(5,:,:)=-1;
[x,y,z]=gradient(a);

Look at x,y, and z and see that everything is NOT fine. 
What should have happened:

It should be putting the three output elements in the right order.

Please describe any relevant documentation references:

    [FX,FY,FZ] = GRADIENT(F), when F is a 3-D array, returns the
    numerical gradient of F. FZ corresponds to dF/dz, the differences
    in the z direction. GRADIENT(F,H), where H is a scalar, 
    uses H as the spacing between points in each direction.


home help back first fref pref prev next nref lref last post