# Visualization of Data in polar coordinates

 Register Blogs Members List Search Today's Posts Mark Forums Read

 December 2, 2002, 14:45 Visualization of Data in polar coordinates #1 Sujit Kirpekar Guest   Posts: n/a Hi, Can anyone help in converting a polar grid (r- and theta-) to X and Y for the purpose of plotting (The gird is unevenly spaced in r- and of course, evenly spaced in theta-)? MATLAB can do it using griddata() but cannot compute values close to the origin. MATLAB returns NaN (Not a Number) value for points near the origin. Is there any visualization software (free, Unix based) that can read in 2D matrices with rows representing the r- direction and columns the theta- direction (and each element filled with value representing the function at that value of r- and theta-)? Many Thanks --Sujit

 December 2, 2002, 16:59 Re: Visualization of Data in polar coordinates #2 Pete Guest   Posts: n/a Are you asking for simply: x = r*cos(theta) y = r*sin(theta) or am I missing something?

 December 2, 2002, 18:21 Re: Visualization of Data in polar coordinates #3 Sujit Kirpekar Guest   Posts: n/a Yes exactly, but its a little more complicated. Here's how: I have a 2D (say N by N) matrix with where each element corresponds to the value of a function at certain r and certain theta. By doing x = r*cos(theta) and y = r*sin(theta) I get a set of (N*N) x's and (N*N) y's because for each x there are N r's and N theta's. So now I have a N*N matrix for the x-coordinates and another N*N matrix for the y-coordinates. Clearly, values of x- and y- are unevenly spaced. The question is .. how do I interpolate my data which is evaluated at these various N*N x's and y's to an evenly spaced grid? MATLAB needs an evenly spaced 2D grid to plot countours or surfaces. I hope you understand the problem. Thanks for your interest -- Sujit

 December 3, 2002, 05:32 Re: Visualization of Data in polar coordinates #4 Praveen Guest   Posts: n/a Matlab does not require evenly spaced data. You can simply calculated the x and y coordinates and use them directly in contour function.