LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

vector gradient calculation

I have a matrix (30X30) of electric potentials that I want to be able to convert to electric field components (x and y) at each point in the matrix. I have tried using a matlab script (with gradient command), but there seems to be something strange going on. Is there a way to do this easily in labview, or another way to do this in matlab? Has anyone else run into simlar problems? Thanks,

Joel
0 Kudos
Message 1 of 2
(3,514 Views)
Hi,
you know that gradient is just the spatial differentiation of your 2D function.

grad U(x,y) = vector(dU/dx; dU/dy)

So all you need is to calculate derivatives of different rows and columns and to organize thm into 2D array of vectors.
You have to extract each row and calculate its derivative. This will be the array of dU/dx.
The same thing with columns to calculate dU/dy.

I've attached the example of how to do it. There you must specify 2D array and values for dx and dy between points. And this will return the gradient of your function.

Good luck.

Oleg Chutko.
0 Kudos
Message 2 of 2
(3,514 Views)