displaying the radius on the plot

5 views (last 30 days)
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

Accepted Answer

Star Strider
Star Strider on 9 Jun 2019
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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!