clc, clear, close all;
a=[1 10 100 1000; 1 15 225 3375; 1 20 400 8000; 1 22.5 506.25 11391.625];
b =[227.04; 362.78; 517.35; 602.97];
c=a\b;

coeffs = flipud(c)';

t_val = 16;
x_predicted = polyval(coeffs,t_val);
x_predicted_accel = polyval(polyder(coeffs),t_val);

t_plot = linspace(0,30,100);
x_plot = polyval(coeffs, t_plot);

real_t = [0 10 15 20 22.5 30];
real_x = [0 227.04 362.78 517.35 602.97 901.67];

plot(t_plot,x_plot,'LineWidth',2)
hold on;
plot(real_t,real_x, 'LineWidth',2)

disp(x_predicted)
disp(x_predicted_accel)
disp(coeffs)