how to plot this ?

i have a circle and i want to plot his half radius in the same figure can anyone help me :
angle=linspace(0,2*pi,360);
x=cos(angle);
y=sin(angle);
plot(x,y)
axis('equal')

3 comentarios

Walter Roberson
Walter Roberson el 21 de Abr. de 2019
I am not sure what you mean about "his half radius" ? Do you mean a second circle with half the radius? If so then plot(x/2, y/2)
diadalina
diadalina el 21 de Abr. de 2019
thank mr walter for your response, i mean by his half radius, the line that cuts its half radius
Walter Roberson
Walter Roberson el 21 de Abr. de 2019
Which angle should it be drawn at?

Iniciar sesión para comentar.

Respuestas (1)

KSSV
KSSV el 22 de Abr. de 2019

1 voto

angle=linspace(0,2*pi,360)';
C = [0 0] ;
R = 1 ;
x=C(1)+R*cos(angle);
y=C(2)+R*sin(angle);
%
x1 = R/2*cos(angle) ;
y1 = R/2*sin(angle) ;
plot(x,y)
hold on
C1 = repmat(C,length(angle),1) ;
plot([C1(:,1) x1]',[C1(:,2) y1]')
axis('equal')

4 comentarios

diadalina
diadalina el 22 de Abr. de 2019
thank you mr KSSV for your answer but i want somthing like this :circle.png
Walter Roberson
Walter Roberson el 22 de Abr. de 2019
hold on
plot([0 1], [0 0])
hold off
This relies on the fact that the center of the circle is at 0, 0 and the radius of the circle is 1.
diadalina
diadalina el 22 de Abr. de 2019
thank you mr walter for your help ;
KSSV
KSSV el 23 de Abr. de 2019
angle=linspace(0,2*pi,360)';
C = [0 0] ;
R = 1 ;
x=C(1)+R*cos(angle);
y=C(2)+R*sin(angle);
%
x1 = R*cos(0) ;
y1 = R*sin(0) ;
plot(x,y)
hold on
plot([C(:,1) x1]',[C(:,2) y1]')
axis('equal')

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 21 de Abr. de 2019

Comentada:

el 23 de Abr. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by