% Given data points t = [10, 15, 20]; v = [227.04, 362.78, 517.35]; t_interpolate = 16; L2 = 0; for i = 1:length(t) term = v(i); for j = 1:length(t) if j != i term *= (t_interpolate - t(j)) / (t(i) - t(j)); end end L2 += term; end fprintf('The velocity %.2f m/s\n', t_interpolate, L2);