MATLAB Answers

How can I plot a 2D array using polar coordinates?

조회 수: 40(최근 30일)
Jiong Yang
Jiong Yang 2020년 5월 4일
댓글: Jiong Yang 2020년 5월 6일
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
Jiong Yang
Jiong Yang 2020년 5월 5일
Attached is the data. It has 157 rows and 112 columns.
I got this array by calculation. Each row equals 0.01 theta, and the total polar angle is pi/2. Each column equals 0.01 in radius.
Thank you very much.

댓글을 달려면 로그인하십시오.


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
  댓글 수: 1
Jiong Yang
Jiong Yang 2020년 5월 6일
Thank you, Darova. I tried something else and got it done. Thank you anyway!

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by