How can I calculate the gradient of my data that is in the polar coordinates in MATLAB 7.8 (R2009a)?

I have a dataset in the polar coordinates and would like to calculate its gradient but cannot find a function for the same.

 Accepted Answer

The ability to directly calculate the gradient of data that is in the polar coordinates in not available in MATLAB 7.8 (R2009a).
The general equation for the polar gradient is:
gradient(F) = del(F)/del(r) + 1/r * del(F)/del(theta)
As a workaround, given:
F = matrix of F values varying along r and theta
r = vector of radius values
theta = vector of radian values
the following code can be used to calculate the gradient.
% Take the gradient of F, suppose that the values of r vary along the rows
% (and are constant along the columns) and that the values of theta vary
% along the columns and are constant along the rows.
[ dFr dFt ] = gradient(F,r,theta);
% Modify the results for dFt, as the second term in the polar gradient
% is divided by the value of r
dFt = dFt./(repmat(r(:)',length(theta),1);

More Answers (0)

Products

Release

R2009a

Tags

No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!