How to randomly plot circles on grid lines and determine coordinates of intersection?
Show older comments
I'm trying to create my own vertical and horizontal grid lines and then plot multiple circles randomly over it. I then want to determine the points where the grid lines and circles intersect. The diameter of the circle should not exceed the length of one grid. All circles should be of equal size to each other. This is the code that I have at the moment (that I took from other sources) does not output what I want and is completely wrong. I don't fully understand the code so any help would be great! Thanks in advance.
x = 0:30;
y = 0:30;
figure(1)
plot(repmat(x,2,length(x)), [0 length(y)-1])
hold on
plot([0 length(x)-1], repmat(y,2,length(y)))
hold on
r=10;
center=[20,30];
t=-pi:0.001:pi;
x=r*cos(t)+center(1);
y=r*sin(t)+center(2);
plot(x,y)
hold off
axis equal
Accepted Answer
More Answers (0)
Categories
Find more on Polar Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!