Clear Filters
Clear Filters

Conversion of Polar Data to Cartesian Data

31 views (last 30 days)
Gabriel Williams
Gabriel Williams on 22 May 2017
Answered: David Ding on 26 May 2017
Good Morning,
I have an interpolation problem that I thought others would have more insight on. I have cartesian data Z(x,y) where x and y are vectors that describe the locations of the values of Z in terms of Cartesian coordinates. My goal is to take this data and to project it upon a polar grid so that I can perform an azimuthal average of the data.
To get the data Z(x,y) onto a polar grid, I essentially use the griddata function:
subplot(2,2,[1 3]); contourf(X/1000,Y/1000,vor); axis([-100 100 -100 100]);
subplot(2,2,[2 4]); contourf(R0/1000,TH0,vor_polar); axis([0 100 -3 3]);
This procedure works fine if Z(x,y) has ideal circular symmetry, such as shown in Figure 1. However, when I begin to add asymmetries to Z(x,y) (i.e. perturbations which drives the data away from circular symmetry) as in Figure 2, the interpolation scheme doesn't seem to pick up these asymmetries. I wanted to know if there are any underlying problems with my procedure or if this is related to the griddata function.

Answers (1)

David Ding
David Ding on 26 May 2017
Hi Gabe,
The function "cart2pol" already converts the coordinates from Cartesian to polar. At each (r0, th0) point, the value of "vor" should be the same as "vor_polar" as there is a one-to-one mapping between the Cartesian coordinate and the polar coordinate. Therefore, you do not need to use "griddata".
In any case, "griddata" function's fourth and fifth argument accepts only Cartesian coordinates. When you input polar coordinates, certain points have value "NaN", which results in the interpolated points not picking up the asymmetries.
is suffice to map the data "vor" onto polar coordinates.


Find more on Interpolation 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!