eraserPos

%geometric definitions

L0 = 8;
t0 = 49;
dX0 = 3;
L2 = 4;
L3 = 8;
L3O = 4;
L4 = 6.25;
t2i = 0;
%time based definitions
w2R = 50; %RPM
w2 = w2R * 2*pi/60; %rad/s
rp = 15/25.4; %pitch radius
vx = w2*rp;
lWB = 45/2.54; %length of whiteboard
tmax = lWB/vx;
tsample = tmax / 1000;
timeVals = [0:tsample:tmax];
t2 = timeVals * w2*180/pi + t2i;
dX = vx*timeVals;
%position analysis
t1 = atan2d(-L0*sind(t0), L0*cosd(t0) - dX0);
L1 = sqrt( (L0*cosd(t0) - dX0)^2 + (L0*sind(t0))^2 );
lens = [L2, L3, L4, L1];
angles = fourbarR(lens, 180-t1, t2, 1);
t3 = angles(1,:);
t4 = angles(2,:);

Pxi = L2*cosd(t2) + (L3 + L3O)*cosd(t3);
Px = Pxi - dX;
Py = L2*sind(t2) + (L3 + L3O)*sind(t3);

figure(1)
plot(Px, Py)
title('Trajectory of Eraser')