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

60 ビュー (過去 30 日間)
Jiong Yang
Jiong Yang 2020 年 5 月 4 日
コメント済み: Ava 2023 年 11 月 3 日
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
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?
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.

サインインしてコメントする。

回答 (1 件)

darova
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 件のコメント
Jiong Yang
Jiong Yang 2020 年 5 月 6 日
Thank you, Darova. I tried something else and got it done. Thank you anyway!
Ava
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 ExchangePolar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by