Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Circle Coverage Simulator
- % Claire Fredriksson - @fuzzybluerain
- % inspired by @pendulum_bot
- % setting initial positions of the circles
- function circles = circlecoverage(x1init,y1init,x2init,y2init)
- % evaluating length of the pendulums - they're the square of what they need
- % to be so that the calculations are easier in later portions of the
- % program
- length1 = (x1init^2)+(y1init^2);
- length2 = ((x2init-x1init)^2)+((y2init-y1init)^2);
- % giving us 360 points for each given angle - could do more
- angles = linspace(0, 2*pi, 360);
- x1 = length1 * cos(angles);
- y1 = length1 * sin(angles);
- for k = 1:360
- % running the same process at 360 equidistant points along the inner
- % circle, so that we can generate the resultant circles for each point
- x2 = length2 * cos(angles) + (length1 * cos(angles(k)));
- y2 = length2 * sin(angles) + (length1 * sin(angles(k)));
- plot(x2, y2, 'b-', 'LineWidth', 0.5);
- hold on;
- end
- plot(x1, y1, 'r-', 'LineWidth', 4);
- hold on;
- axis equal;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement