![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/678798/image.jpeg)
radial value in polar plot doesn't connect as intended
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Arief Yoga Randytama
le 9 Juil 2021
Commenté : Simon Chan
le 9 Juil 2021
I want to make a polar plot that connects the radial value of each angle kind of like the attached image.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/678748/image.png)
However when I try to plot it in matlab, the radial value doesn't seem to be connected as desired and the is a value in between the angle which i do not intend. is there anything wrong with my code? thanks
deg=0:30:330;
max=[2 2.14 2 1.86 2.14 2.71 2.54 2.29 2.29 2.43 2 1.86];
min= [2.14 2.57 2.29 2.29 2.43 3 2.86 2.71 2.71 2.71 2.14 2];
polarplot(deg,max)
ax=gca
ax.ThetaZeroLocation='top'
ax.ThetaDir='clockwise'
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/678753/image.png)
3 commentaires
Simon Chan
le 9 Juil 2021
Just add the first point to the end:
deg=0:30*pi/180:360*pi/180;
max=[max, max(1)];
polarplot(deg,max);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/678848/image.jpeg)
Réponse acceptée
Chunru
le 9 Juil 2021
deg=0:30:330;
max=[2 2.14 2 1.86 2.14 2.71 2.54 2.29 2.29 2.43 2 1.86];
min= [2.14 2.57 2.29 2.29 2.43 3 2.86 2.71 2.71 2.71 2.14 2];
polarplot(deg2rad(deg([1:end 1])),max([1:end 1])); % cycle back to 1st point
ax=gca;
ax.ThetaZeroLocation='top';
ax.ThetaDir='clockwise';
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Polar Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!