McGill University
School of Computer Science

Computer Science COMP 199 (Winter term)
Excursions in Computing Science

%MATLABpak03: StanTrav

% StanTrav.m	THM	070129
% Stanley standing and Travis travelling for Galileo and Lorentz
hold off
clear Ug, clear Vg, clear Ul, clear Vl
v = 0.1;
G = [1,0;-v,1];
L = (1/sqrt(1-v^2))*[1,-v;-v,1];
T = [0,2,0,-2,-1.5,-.5];
X = [0,0.2,0.8,4/3,0,0];
for j = 1:6
    TX = [T(j);X(j)];            %TX is Stan's frame
    UV = G*TX;                   %UV is Trav's frame: this is Galileo
    Ug(j) = UV(1);
    Vg(j) = UV(2);
    UV = L*TX;                   %UV is Trav's frame: this is Lorentz
    Ul(j) = UV(1);
    Vl(j) = UV(2);
hold on
plot(Ug,Vg,'+')                   %put this in for Galileo
%plot(Ul,Vl,'+')                   %put this in for Lorentz
axis([-3 3 -1 2])
legend('in Stan''s frame','in Trav''s frame')