Plotting points inside a circle
조회 수: 15 (최근 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!