how to plot excel data in a polar graph?

hello everyone , I have Cartesian values in an excel table and I want to plot them in a polar graph, I have transformed them into polar values and radian. by executing the code I have only the empty graph that appears. Help me please. here is the code I use.
dataset=xlsread('tabl.xlsx','tableau','D2:E131');
x=dataset(:,1);
y=dataset(:,2);
[t,r] = cart2pol(x,y),
x1=t*deg2rad;
y1=r*deg2rad;
polarplot(x1,y1,'g','markers',20);

 採用された回答

Star Strider
Star Strider 2018 年 10 月 24 日

0 投票

Note that deg2rad requires arguments. I am somewhat surprised not providing them did not throw an error.
You do not need to use it anyway. From the cart2pol documentation for theta (link):
  • Angular coordinate, returned as an array. theta is the counterclockwise angle in the x-y plane measured in radians from the positive x-axis. (Emphasis added.)
You did not provide your ‘tabl.xlsx’ file, so we cannot specifically help you with it. Nevertheless, try this:
polarplot(t, r, 'g', 'markers',20);

4 件のコメント

fati jadid
fati jadid 2018 年 10 月 24 日
thank you for your reply, with or without deg2grad it gives the same thing. any way here is the excel file
Star Strider
Star Strider 2018 年 10 月 24 日
It does plot. There is a tight cluster of dots at 79.47° at a radius of about 38.31:
figure
polarplot(t, r, '.g');
If you first subtract the mean of the two vectors, you get a result that is likely closer to what you want to see:
[t,r] = cart2pol(x-mean(x),y-mean(y));
figure
polarplot(t, r, '-g');
fati jadid
fati jadid 2018 年 10 月 24 日
thank you verry much it works
Star Strider
Star Strider 2018 年 10 月 24 日
My pleasure.
If my Answer helped you solve your problem, please Accept it!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangePolar Plots についてさらに検索

質問済み:

2018 年 10 月 24 日

コメント済み:

2018 年 10 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by