How can I plot a 2D array using polar coordinates?
조회 수: 60 (최근 30일)
이전 댓글 표시
Hi,
I have a 2D array, with each row representing polar angle 'theta' and each column representing 'value' at paticular radius.
When I use 'imagesc', I got this (x-axis is the radius axis, y-axis is the theta axis)
How can I plot this array in polar coordinates?
댓글 수: 2
Image Analyst
2020년 5월 5일
How many rows and columns, and what is the formula relating row number to angle, and column number to radius?
답변 (1개)
darova
2020년 5월 5일
Convert your data to cartesian system of coordinates
A = xlsread('data.xlsx');
%%
t = linspace(0,pi/2,size(A,1)); % create angle
r = (1:size(A,2))*0.01; % create radius
[T,R] = ndgrid(t,r); % 2d matrices
[X,Y] = pol2cart(T,R); % polar to cartesian
surf(X,Y,A,'edgecolor','none')
view(2)
댓글 수: 2
Ava
2023년 11월 3일
Hi @Jiong Yang, may I ask how you solved this? I am working on an plotting ozone levels over Antarctica with a 2D array and would like to "imagesc" the data but with the rows and columns representing angle and radius.
참고 항목
카테고리
Help Center 및 File Exchange에서 Polar Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!