Re: How to calculate gradient and laplace of a list

• To: mathgroup at smc.vnet.net
• Subject: [mg72902] Re: How to calculate gradient and laplace of a list
• From: dh <dh at metrohm.ch>
• Date: Wed, 24 Jan 2007 17:37:36 -0500 (EST)
• References: <ep4kd5\$rat\$1@smc.vnet.net>

```Hi,
you can do this using ListCorrelate or ListConvolve. For ListCorelate
the Kernel would be:
x component of Gradient: ker={{0,0,0},{-1,0,1},{0,0,0}}/2
y component of Gradient: ker={{0,1,0},{0,0,0},{0,-1,0}}/2
Laplacian: ker={{0,1,0},{1,-4,1},{0,1,0}}/4
you would then write:
ListCorrelate[ker,matrix]
To plot you can use: ListPlotVectorField from: Graphics`PlotField`. But
you first have to prepare the data. Assume that gradx and grady are
matrixes with the corresponding components, then the gradient matrix is:
and we get a Plot by:
<<Graphics`PlotField`
Daniel

leoshen wrote:
> Hi, guys
> I have a matrix of n*m read from a file. mathematica has built in function
> to do discrete fourier transform of the list.
> Can I calculate the gradient and the laplace of the matrix?
> I can use the listcontourplot to plot the matrix, Is there any way to plot
> the gradient plot of it?
>
>
>
>

```

• Prev by Date: Re: FourierTransform help
• Next by Date: 2D interpolation
• Previous by thread: Re: How to calculate gradient and laplace of a list
• Next by thread: Re: Running Galois.m on Version 2.2.2