MATLAB: Displaying the radius on the plot

plot radius circlr

HI everyone i have 2 cocentric circle which are of radius 1.5 and rafius 2 . i just want to be able to display the radius on to the plot once simulated . How do i do dat ?
Thank you

Best Answer

I am not quite certain what you want.
The Code —
t = linspace(0, 2*pi);
r = [1.5; 2]; % Radius
ctr = [0.5; 0.2]; % Circle Center
x = [r*cos(t) + ctr(1)]';
y = [r*sin(t) + ctr(2)]';
figure
plot(x, y)
hold on
plot([1 1]*ctr(1), [1 1]*ctr(2),'+r') % Plot Center
plot([ctr(1) x(20,1)], [ctr(2) y(20,1)],'-b')
plot([ctr(1) x(40,2)], [ctr(2) y(40,2)],'-r')
hold off
axis equal
axis([ -3 3 -3 3])
text(x(20,1), y(20,1), '$R\ =\ 1.5$','Interpreter','latex')
text(x(40,2), y(40,2), '$R\ =\ 2.0$','Interpreter','latex')
The Plot —
displaying the radius on the plot - 2019 06 08.png
This draws the radii and labels them.
Experiment to get the result you want.