Plotting points inside a circle
10 ビュー (過去 30 日間)
古いコメントを表示
This is probably a very simple question, I’m new to MatLab and I’ve always really used Python. I need to plot a set of points (position of a chemical inside a nucleus) inside a circle of radius 5. How would you go about this? I can plot the circle, and I have the coordinates (polar) of the points, I just can’t add those points.
0 件のコメント
回答 (1 件)
Walter Roberson
2022 年 6 月 22 日
maxr = 5;
%create data
N = 20;
r = rand(1,N) * maxr;
theta = rand(1,N) * 2*pi;
[x, y] = pol2cart(theta, r);
%plot
scatter(x, y, 'b*');
hold on
viscircles([0 0], maxr);
hold off
axis equal
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Polar Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!