
%
% trailer.m
%
% plot the reference and deformed trailer
%

function trailer(k,f)

xc = [0 0; 0 1; 0 1; 1 1; 1 2; 1 2; 2 2];
yc = [0 1; 0 1; 1 1; 0 1; 0 1; 1 1; 0 1];
line(xc',yc')

s = 1/sqrt(2);

A = [0  1  0  0  0  0
     0  0  s  s  0  0
    -1  0  1  0  0  0
     0  0  0  1  0  1
     0  0  0  0  s  s
     0  0 -1  0  1  0
     0  0  0  0  0  1];

K = diag(k);

S = A'*K*A;

x = S\f';

dxc = xc;
dxc(2:2:6,2) = dxc(2:2:6,2)+x(1:2:5);

dyc = yc;
dyc(

