- #1
pamparana
- 128
- 0
Hello everyone,
I have a newbie Matlab question. I need to set up a 2D array 'phi' whose gradient is an identity mapping in terms of the spatial coordinate.
So, basically I have a 2D image and what I want to do is set up phi at each pixel (x, y) as follows:
phi(x, y) = 0.5 * (x^2 + y^2), so that grad(phi(x, y)) = (x, y).
My question is how can I set this up in Matlab in an efficient way. So, given a 2D image, how can I set up this phi using the equation phi(x, y) = 0.5 * (x^2 + y^2).
Any help would be greatly appreciated.
Many thanks,
Luca
I have a newbie Matlab question. I need to set up a 2D array 'phi' whose gradient is an identity mapping in terms of the spatial coordinate.
So, basically I have a 2D image and what I want to do is set up phi at each pixel (x, y) as follows:
phi(x, y) = 0.5 * (x^2 + y^2), so that grad(phi(x, y)) = (x, y).
My question is how can I set this up in Matlab in an efficient way. So, given a 2D image, how can I set up this phi using the equation phi(x, y) = 0.5 * (x^2 + y^2).
Any help would be greatly appreciated.
Many thanks,
Luca