# How to plot midpoints between the points of circle ?

14 views (last 30 days)
Eleni agou on 17 Sep 2018
Edited: Eleni agou on 18 Sep 2018
I draw a circle with s1=4 points.
I have this code
t1 = 0:(pi/(5*s1)):2*pi; % s1 is the number of points I want to have on the circle
x1unit = r1 * cos(t1) + x1;
y1unit = r1 * sin(t1) + y1;
a1=x1unit(1:10:s1*10); % is xi for my circle
b1=y1unit(1:10:s1*10); %is yi
plot(x1unit, y1unit, 'b', x1, y1, 'ok');%circle with the center x1,y1
plot(a1, b1, 'o'); % x,y for s1 times my points
if I want to add one point right in the middle, between to other points(a1,b1) I use this code:
ae1=x1unit(6:10:s1*10);
be1=y1unit(6:10:s1*10);
So, I have one midpoint [s1=4, (1-2,2-3,3-4,4-1) ] . I want more midpoints, for example three or n,if it is possible .
If I want 3 points i use this code
ae11=x1unit(3:10:s1*10);
be11=y1unit(3:10:s1*10);
ae12=x1unit(6:10:s1*10);
be12=y1unit(6:10:s1*10);
ae13=x1unit(9:10:s1*10);
be13=y1unit(9:10:s1*10);
but I don't like this way. Maybe there is more practical way with less code.
My plot is the following picture.Ignore the inner circle. I would like 9 green points,instead one.
like the 3 blue dots,like in the picture:
How I have 9 points which equidistant between the s1 points ???

Jan on 17 Sep 2018
Edited: Jan on 17 Sep 2018
Create the coordinates of the wanted points directly:
x1 = 0;
y1 = 0;
r1 = 1;
n = 3; % Points per quadrant
t2 = linspace(0, 2*pi, 4 *(n+1) + 1);
t2(end) = []; % Do not draw last point twice
xx2 = r1 * cos(t2) + x1;
yy2 = r1 * sin(t2) + y1;
plot(xx2, yy2, 'o');

Eleni agou on 17 Sep 2018
I have one more circle in this way.I want only the points between the x points, like the 2on image.
Jan on 18 Sep 2018
My code does not draw an additional circle. If you see a circle, you are using a different code. Of course you have to adjust the values for x1, y1, r1, which I had guessed, because you did not provide them.
Eleni agou on 18 Sep 2018
I create points with this code:
a1=x1unit(1:10:s1*10);
b1=y1unit(1:10:s1*10);
and I want to add points, between (a1,b1)i and i=1:s1. If I correct my t1 with yours(t2) I have an error about my table with my points. My Error is:
Index exceeds matrix dimensions. Error in circle17_9 (line 24) a1=x1unit(1:10:s1*10);
so I thought to do this
a1=x1unit(1:10:s1*2*pi)
and the code runs. But I have not midpoints.
I want to ask you about the logic for this:
t2 = linspace(0, 2*pi, 4 *(n+1) + 1);
is 0-2pi ,for draw a circle. n is the points I want. and 4*(n+1)+1 is because you divide a circle to 4 quadrant??
I want to calculate 2 different equations. One for midpoints and one for the first(s1) points. In my icons, one for blue dots and one for x points.So, I need something to find only the x points and then olny midpoints between x on my circle.