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

17 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
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)

Categories

Find more on Cartesian Coordinate System Conversion in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2009a

Community Treasure Hunt

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

Start Hunting!