How can i save a circle coordinates in a matrix?

Hi everybody!
i want to make a circle in matlab with the following conditions.
  • the radius of the circle is 1 cm also i must use it in meter so 0,01
  • The delta phi is 1 degress
  • the center point of the circle is x = 0 y = 0 z =0
I need to calculate out the x coordinates of the circle, the y coordinates of the circle and z coorinates are constant = 0. All of these results
should be in a matrix where the first coloumn contains the x coordinates, the second contains the y coordinates and the third are zeros, because z = 0
The program should know that, when i give for the radius and
the delta phi other values, it will works always good.
Thank you for your help!
Peter

Answers (1)

R = 0.01; % Radius
C = [90. 0.] ;
th = (0:1:360)' ;
x = C(1)+R*cosd(th) ;
y = C(2)+R*sind(th) ;
z = zeros(size(th)) ;
P = [x y z] ;
plot3(x,y,z)

2 Comments

Thank you guys! It works! :)
You said "the center point of the circle is x = 0 y = 0 z =0" so use this C instead:
C = [0, 0];
Please "Accept this Answer" since you said it works.

Sign in to comment.

Categories

Asked:

on 1 Nov 2020

Commented:

on 1 Nov 2020

Community Treasure Hunt

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

Start Hunting!