close all; clear; clc;
L1 = 110.0;
L2 = 140.0;
lx(1) = 0.0;
ly(1) = 0.0;
lx(2) = lx(1) + L1;
ly(2) = ly(1) ;
lx(3) = lx(2) ;
ly(3) = ly(2) +L2;
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('Growing Plant: CLICK ON THE IMAGE TO ANIMATE once','Color',[0 0 1])
hold on
ht(1) = plot(lx(1:2), ly(1:2), 'color', [0 .5 0],'LineWidth',3);
ht(2) = plot(lx(2:3), ly(2:3), 'color', [0 1 0],'LineWidth',3);
ht(3) = plot(lx(1),ly(1),'--mo', 'MarkerEdgeColor','k', 'MarkerFaceColor',[0 1 0], 'MarkerSize',6);
ht(4) = plot(lx(2),ly(2),'--mo', 'MarkerEdgeColor','k', 'MarkerFaceColor',[0 1 1], 'MarkerSize',6);
ht(5) = plot(lx(3),ly(3),'--mo', 'MarkerEdgeColor','k', 'MarkerFaceColor',[1 0 0], 'MarkerSize',6);
waitforbuttonpress;
pause on
for j = 10:300
lx(2) = j/3;
ly(2) = j/2;
lx(3) = j;
ly(3) = j;
set(ht(1),'XData',lx(1:2)); set(ht(1),'YData',ly(1:2));
set(ht(2),'XData',lx(2:3)); set(ht(2),'YData',ly(2:3));
set(ht(3),'XData',lx(1)); set(ht(3),'YData',ly(1));
set(ht(4),'XData',lx(2)); set(ht(4),'YData',ly(2));
set(ht(5),'XData',lx(3)); set(ht(5),'YData',ly(3));
drawnow
pause(0.02);
end
saveas(gcf,'output.jpg');