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)
Show older comments
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
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);
0 Comments
More Answers (0)
See Also
Categories
Find more on Cartesian Coordinate System Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!