close all;
clear;
clc;
L1 = 110.0;
L2 = 140.0;
lx(1) = 0.0;
ly(1) = 0.0;
lx(2) = lx(1);
ly(2) = ly(1) + L1;
lx(3) = lx(2) - L2;
ly(3) = ly(2);
fprintf(1, '\n lx[1] = %-7.2f lx[2] = %-7.2f lx[3] = %-7.2f', lx(1), lx(2), lx(3));
fprintf(1, '\n ly[1] = %-7.2f ly[2] = %-7.2f ly[3] = %-7.2f', ly(1), ly(2), ly(3));
fprintf(1, '\n');
hf = figure('color','white');
axis equal
SUM_L1_L2 = L1 + L2;
maximum_x_limit = ceil(SUM_L1_L2/100)*100;
maximum_y_limit = ceil(SUM_L1_L2/100)*100;
minimum_x_limit = - ceil(SUM_L1_L2/100)*100;
minimum_y_limit = - ceil(SUM_L1_L2/100)*100;
xlim([minimum_x_limit maximum_x_limit]);
ylim([minimum_y_limit maximum_y_limit]);
set(gca,'XTick',minimum_x_limit : 100 : maximum_x_limit);
set(gca,'YTick',minimum_y_limit : 100 : maximum_y_limit);
grid on
set(gca, 'GridLineStyle', '-');
grid(gca,'minor')
title('Robotic Arm','Color',[.6 0 0])
hold on
plot(lx(1:2), ly(1:2), 'color', [.4 .4 .8],'LineWidth',3);
plot(lx(2:3), ly(2:3), 'color', [.8 .4 .8],'LineWidth',3);
plot(lx(1),ly(1),'--mo', 'MarkerEdgeColor','k', 'MarkerFaceColor',[.49 1 .63], 'MarkerSize',6);
plot(lx(2),ly(2),'--mo', 'MarkerEdgeColor','k', 'MarkerFaceColor',[.99 1 .63], 'MarkerSize',6);
plot(lx(3),ly(3),'--mo', 'MarkerEdgeColor','k', 'MarkerFaceColor',[.49 0 .63], 'MarkerSize',6);
str_1 = sprintf(' L1 = %06.2f mm', L1);
str_2 = sprintf(' L2 = %06.2f mm', L2);
str_3 = sprintf(' [ lx(1) = %06.2f, ly(1) = %06.2f ]', lx(1),ly(1));
str_4 = sprintf(' [ lx(2) = %06.2f, ly(2) = %06.2f ]', lx(2),ly(2));
str_5 = sprintf(' [ lx(3) = %06.2f, ly(3) = %06.2f ]', lx(3),ly(3));
legend(str_1, str_2, str_3, str_4, str_5);
saveas(gcf,'output.jpg')
lx[1] = 0.00 lx[2] = 0.00 lx[3] = -140.00
ly[1] = 0.00 ly[2] = 110.00 ly[3] = 110.00