Polar map to cartesian grid

조회 수: 5 (최근 30일)
David Santos
David Santos 2019년 3월 1일
답변: Divyajyoti Nayak 2025년 6월 18일
Hi,
I'm working with data in polar coordinates:
rr=vector of distances, 1x2029;
bearings=angles, 1x180;
TLp= z value at each rr,bearings , 2029x180
I've tried using pol2cart:
[xx,yy,zz]=pol2cart(bearings,rr,TLp);
But is not working because all the vector have to be the same size, any clues of how to solve it?

답변 (1개)

Divyajyoti Nayak
Divyajyoti Nayak 2025년 6월 18일
To use the 'pol2cart' function the radii and angle vectors need to be of equal size, as they define the coordinates of the points. The 'rr' and 'bearings' variables are possible values for the radii and angles, so they can be used to make a polar grid using the 'meshgrid' function. This grid then can be used by the 'pol2cart' function to convert into a cartesian grid. Here's some sample code:
clc
clear
r = 0:1:2028; % 1 X 2029
theta = linspace(0,pi,180); % 1 X 180
zPolar = r'*sin(theta); % 2029 X 180
[rGrid, thetaGrid] = meshgrid(r,theta);
[x,y,z] = pol2cart(thetaGrid,rGrid,zPolar');
Here's the documentation to the 'meshgrid' and 'pol2cart' functions:

카테고리

Help CenterFile Exchange에서 Cartesian Coordinate System Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by