polar plot bar chart combo or something similar?

3 ビュー (過去 30 日間)
Benjamin Cowen
Benjamin Cowen 2017 年 1 月 9 日
回答済み: KAE 2017 年 4 月 27 日
Hello,
I have 24 spaced angles such as:
[100],
[10tan(15)],
[10tan(30)]
etc.
Note that tan is in degrees.
For each of these angles I have a value. How can I plot a line of that magnitude at each angle? Can MATLAB handle something like this?

採用された回答

Walter Roberson
Walter Roberson 2017 年 1 月 9 日
編集済み: Walter Roberson 2017 年 1 月 9 日
deg = 0:15:359;
theta = 10*tand(deg);
rho = the values corresponding to each angle
polar(theta, rho)
or
polarplot(theta, rho) %recommended if your MATLAB is new enoug
  4 件のコメント
Benjamin Cowen
Benjamin Cowen 2017 年 1 月 9 日
編集済み: Benjamin Cowen 2017 年 1 月 9 日
How do I add points at each spot. I see a zig-zagged line, but how can I add a point at each value to highlight where they are?
Walter Roberson
Walter Roberson 2017 年 1 月 9 日
The revised version
polar([theta;theta], [zeros(size(rho));rho])
does not generate zig-zagged lines.
The zig-zag lines are due to the fact that you specified that your angles are to be 10*tand(0:15:345) which give angles in radians that are all over the place, including +/- infinity.
If you have a column "a" with angles in degrees,
theta = reshape(a*pi/180, 1, []); %want a row output
rho = reshape(b, 1, []); %want a row
polar([theta;theta], [zeros(size(rho));rho])
You could add markers:
polar([theta;theta], [zeros(size(rho));rho], '-*')

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

その他の回答 (2 件)

KAE
KAE 2017 年 4 月 27 日
You might want to see windRose on the file exchange.

John BG
John BG 2017 年 1 月 10 日
Mr Cowen
simplifying for just 5 sections
with a start point set to [10 10]
with possible angles multiple of of let's say 15º
amount_angles=5;
da=15;
a_range=[0:da:360-da];
na=randi([1 numel(a_range)],1,amount_angles);
a=a_range(na); % angles
d=randi([100 1000],1,amount_angles); % section lengths
p0=[10 10]
figure(1);grid on
plot(p0(1),p0(2),'go')
hold all;
for k=1:1:numel(a)
dx=d(k)*sind(a(k))
dy=d(k)*cosd(a(k))
plot([p0(1) p0(1)+dx],[p0(2) p0(2)+dy],'b')
plot(p0(1)+dx,p0(2)+dy,'ro')
p0(1)=p0(1)+dx
p0(2)=p0(2)+dy
end
I have repeated twice and the green point is the start point while the red points are way points, and in blue each section:
.
Mr Cowen if you find this answer useful would you please be so kind to mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John BG

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by