MATLAB Answers

how to draw a number of circle inside large circle having same origin but different radius

4 views (last 30 days)
Syed Farax
Syed Farax on 15 Sep 2021
Edited: KSSV on 15 Sep 2021
clc
close all
clear
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
theta = 0;
radious_large_circle = 20; % radius of the circle
X_large_circle = zeros(360,360);
Y_large_circle = zeros(360,360);
radious_small_circles = 20/360; % radius of the circle
%radious_small_circles(i) = 20/360;
X_small_circles = zeros(360,360);
Y_small_circles = zeros(360,360);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
while theta < 360
for i=1:360
theta = theta + 1;
for j=1:360
radious_small_circles(i,j) = radious_small_circles(i,j)+ 20/360;
X_large_circle(i,j)= radious_large_circle.*cos(theta.*(pi/180)); % X Corridinate of the circle
Y_large_circle(i,j)= radious_large_circle.*sin(theta.*(pi/180)); % Y Corridinate of the circle
Norm_large_circle(i,j)= sqrt((X_large_circle(i,j))^2 + (Y_large_circle(i,j))^2);
%Norm_large_circle(i,j) = norm(X_large_circle(i,j) , Y_large_circle(i,j));
X_small_circles(i,j)=radious_small_circles.*cos(theta.*(pi/180));
Y_small_circles(i,j)=radious_small_circles.*sin(theta.*(pi/180));
Norm_small_circles(i,j)= sqrt((X_small_circles(i,j))^2 + (Y_small_circles(i,j))^2);
%Norm_large_circle(i,j)= sqrt((X_large_circle(i,j))^2 + (Y_large_circle(i,j))^2); % Resultant component made from X and Y Cooridinates
theta = theta + 1;
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1)
%plot(X_large_circle,Y_large_circle)
hold on
plot(X_small_circles,Y_small_circles)

Answers (1)

KSSV
KSSV on 15 Sep 2021
Edited: KSSV on 15 Sep 2021
r = linspace(0,1,10)' ; % Radii
th = linspace(0,2*pi) ;
C = [0 0] ; % Center
x = cos(th) ; y = sin(th) ;
X = C(1)+ r*cos(th);
Y = C(2)+ r*sin(th);
plot(X',Y')

Tags

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!