% Schematic32.m %
clear; clc; clf;
a = 1.3;
b = 0.8;
a1 = 0.2;
b1 = 0.2;
n = 200;
the = linspace(0, 2*pi, n);
x = a*cos(the);
y = b*sin(the);
x1 = a1*cos(the);
y1 = b1*sin(the);
the2 = pi/5.0;
the22 = pi/3.0;
AA= [cos(the2) -sin(the2); sin(the2) cos(the2)];
AA1= [cos(the22) -sin(the22); sin(the22) cos(the22)];
xx = zeros(1,n);
yy = zeros(1,n);
xx1 = zeros(1,n);
yy1 = zeros(1,n);
for i=1:n
    xx(i) = cos(the2)*x(i) - sin(the2)*y(i);
    yy(i) = sin(the2)*x(i) + cos(the2)*y(i);
end
xx = xx + 2.0;
yy = yy + 1.5;
for i=1:n
    xx1(i) = cos(the22)*x1(i) - sin(the22)*y1(i);
    yy1(i) = sin(the22)*x1(i) + cos(the22)*y1(i);
end
xx1 = xx1 + 2.0;
yy1 = yy1 + 1.5;
pos1 = [2.0; 1.5] +  AA*[a;0];
pos2 = [2.0; 1.5] +  AA*[0;b];
pos11 = [2.0; 1.5] +  AA1*[a1;0];
pos21 = [2.0; 1.5] +  AA1*[0;b1];
figure(1)
plot(xx,yy,'k-','linewidth',1)
values = [xx; yy];
patch(xx,yy,[0.8627 0.8627 0.8627])
hold on
plot(xx1(165:188), yy1(165:188),'k-','linewidth',1);
line([2 xx(1)],[1.5 yy(1)],'color','k','linewidth',1);
line([2 xx(3*n/4+23)],[1.5 yy(3*n/4+23)],'color','k','linewidth',1);
line([2 xx(n/4+1)],[1.5 yy(n/4+1)],'color','k','linewidth',1);
axis([0 4 0 4])
N = 51;
t = 0.15;
hold on
plot(values(1,:),values(2,:),'k','linew',1.5);
[m,n]=size(values);
line([0.0 4.0+t],[ 0 0 ],'color','k','linewidth',1);
line([0.0 0.0],[ 0 3.0+t ],'color','k','linewidth',1);
line([4.0 4.0],[ 3 0 ],'color','k','linewidth',1);
line([0 4],[ 3 3 ],'color','k','linewidth',1);
line([0  0.05],[1.5  1.5 ],'color','k','linewidth',1);
line([2  2],[0  0.05 ],'color','k','linewidth',1);
text('Interpreter','latex', 'String','$B$','position',[1.56 1.74],'FontSize',18)
text('Interpreter','latex', 'String','$L$','position',[2.35 1.98],'FontSize',18)
text('Interpreter','latex', 'String','$\theta$','position',[2.27 1.62],'FontSize',18)
text('Interpreter','latex', 'String','$-U$','position',[1.2 -0.13],'FontSize',18)
text('Interpreter','latex', 'String','$U=\dot\gamma y$','position',[2.0 3.15],'FontSize',18)
plot([0 ], [3.0+t],'k^','linewidth',2,'MarkerEdgeColor','k','MarkerFaceColor','k');
plot([4.0+t ], [0],'k>','linewidth',2,'MarkerEdgeColor','k','MarkerFaceColor','k');
text('Interpreter','latex','String','$x$','position',[4.0+t -0.1],'FontSize',20)
text('Interpreter','latex','String','$y$','position',[-0.2 3.+t],'FontSize',20)
text('Interpreter','latex','String','$0$','position',[-0.2 1.5],'FontSize',20)
text('Interpreter','latex','String','$0$','position',[1.96 -0.13],'FontSize',20)
axis image
axis off
box on
axis([-t 4+t -t 4.0+t])
set(gcf,'PaperPositionMode','auto')