Plotting a kind of tree
Show older comments
Hello, i need a help. I am plotting attached shape with two plot command like
x1=-22.5;
x2=-37.5
y1=0;
y2=15;
x = [x1, x2, x2, x1, x1];
y = [y1, y1, y2, y2, y1];
plot(x, y, 'r', 'LineWidth', 3);
hold on;
xC= 30;
yC = -30;
xR = 15;
yR = 30;
theta = 0 : 0.01 : 2*pi;
binax = xR * cos(theta) + xC;
binay = yR * sin(theta) + yC;
plot(binay, binax , 'r','linewidth',3);
But i need to plot it with one plot command. Can you please help me? Thank you.

Answers (1)
KSSV
on 22 Nov 2020
x1 = -22.5;
x2 = -37.5;
y1 = 0;
y2 = 15;
x = [x1, x2, x2, x1, x1];
y = [y1, y1, y2, y2, y1];
xC = 30;
yC = -30;
xR = 15;
yR = 30;
theta = 0: 0.01: 2 * pi;
binax = xR * cos (theta) + xC;
binay = yR * sin (theta) + yC;
%% Merge both the points
x = [x NaN binay];
y = [y NaN binax];
plot (x, y, 'r' , 'LineWidth' , 3);
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!