function x = interp_poly_coeffs(t,b)
% input: t and b are vectors specifying the interpolation data
% output: x, coeffs of interp poly
n = length(t);
if n ~= length(b)
    error('lengths incompatible')
end
powers = 0:n-1;
% construct the Vandermonde matrix
for j=1:n
    A(:,j) = t.^powers(j);
end
% solve the linear system
x = A\b;
% get a grid of points on which to plot the polynomial
N = 100;
tt = linspace(t(1),t(n),N)
powersoftt = ones(1,N) % power 0
bb = zeros(1,N);
for j=1:n
    bb = bb + x(j)*powersoftt
    powersoftt = powersoftt .* tt;
end
figure(1)
clf
plot(t,b,'*')
hold on
plot(tt,bb,'r.')
    