figure;  h = drawpolyline;  hold on;
p = sortrows(h.Position);
x = p(:,1); y = p(:,2);
% [x, i] = sort(x); y = y(i);
x2 = min(x) + (0:0.01:1)'*range(x);

plot(x2, interp(x, y, x2), 'g', 'linewidth', 2);

%%
function y2 = interp(x, y, x2)
    % construct matrix A

    % solve for coefficient

    % evaluate the function at x2
end

