| 1234567891011121314 |
- t = [0 1 2 3 4 5];
- x = [1.1 4.4 11.2 20.3 33.1 48.6];
- t = t';
- x = x';
- A = [t.^2 t ones(6,1)]
- p = A\x;
- t_fitted = linspace(min(t), max(t), 100);
- x_fitted = p(1)*t_fitted.^2 + p(2)*t_fitted + p(3);
- hold on;
- plot(t_fitted, x_fitted);
- plot(t, x, 'ro');
|