%
% one mass one spring
%

close all
figure(1)

t = 0:.01:1;

sx = t;
sy = 0.4*sin(4*pi*t);

mx = cos(2*pi*t);
my = sin(2*pi*t);

lx = [0 1];
ly = [0 0];

wx = [0 0];
wy = [-2 2];

plot(wx,wy,'k','linewidth',1.5)
hold
plot(lx,ly+.5,'k','linewidth',1.5)
plot(sx+1,sy+.5,'k','linewidth',1.5)
text(1.4,1.1,'k','fontsize',18)
plot(lx+2,ly+.5,'k','linewidth',1.5)
xval = 4-sqrt(3)/2;
plot([3 xval],[.5 .5],'k','linewidth',1.5)

plot(lx,ly-.5,'k','linewidth',1.5)  % damper
plot([2 1 1 2],[-.25 -.25 -.75 -.75],'k','linewidth',1.5)
plot([1.5 xval],-[.5 .5],'k','linewidth',1.5)
plot([1.5 1.5],-[.3 .7],'k','linewidth',1.5)
text(1.4,-1.1,'d','fontsize',18)

plot(mx+4,my,'k','linewidth',1.5)
text(3.9,-.05,'m','fontsize',18)
plot([4 4],[1.2 1.8],'k','linewidth',1.5)
plot([4.1 4.5],[1.5 1.5],'k','linewidth',1.5)
plot([4.4 4.5],[1.6 1.5],'k','linewidth',1.5)
plot([4.4 4.5],[1.4 1.5],'k','linewidth',1.5)
text(4.6,1.5,'x','fontsize',18)
text(4.6,-1.5,'f','fontsize',18)

plot([4 4],[-1.2 -1.8],'k','linewidth',1.5)
plot([4.1 4.5],-[1.5 1.5],'k','linewidth',1.5)
plot([4.4 4.5],-[1.6 1.5],'k','linewidth',1.5)
plot([4.4 4.5],-[1.4 1.5],'k','linewidth',1.5)

text(0.5,1.5,'(A)','fontsize',20)
%axis equal
axis off
hold

figure(2)
t = 0:.05:16;
xo = exp(-3*t/2).*(cosh(t*sqrt(5)/2)+3*sinh(t*sqrt(5)/2)/sqrt(5));
plot(t,xo,'b','linewidth',1.5)
hold on
xu = exp(-t/2).*(cos(t*sqrt(3)/2)+sin(t*sqrt(3)/2)/sqrt(3));
plot(t,xu,'k','linewidth',1.5)
xc = exp(-t).*(1+t);
plot(t,xc,'r','linewidth',1.5)
xlabel('t','fontsize',14)
ylabel('x','fontsize',14)
text(5,15,'(B)','fontsize',20)
legend('d/m=3','d/m=1','d/m=2')
text(2,1.1,'(B)','fontsize',20)
box off
hold off


