polyval(((-1) .^ (5:-1:0)) ./ (factorial(10:-2:0)), 1)
polyval(((-1) .^ (5:-1:0)) ./ (factorial(10:-2:0)), 1) - cos(1)
x = 1:5; y = polyval(ones(5, 1), x); polyfit(x, y, 4)
x = 1:5; y = 5:-1:1; polyval(polyfit(x, y, 4), x)
x = 1:5; y = 5:-1:1; spline(x, y, x)
x = 1:5; y = 5:-1:1; spline(x, y).coefs(:,4)
x = 1:10 ; y = 1 + x .^ 2;
polyfit(x, y, 1)
polyfit(x, y, 2)
polyfit(x .^ 2, y, 1)
x = 1:10 ; y = x;
v = polyfit(log(x), log(y), 1); [exp(v(2)) v(1)]
v = polyfit(x, log(y), 1); [exp(v(2)) v(1)]
v = polyfit(log(x), log(y), 1); [v(2) v(1)]
v = polyfit(x, log(y), 1); [v(2) v(1)]
x = 1:10 ; y = exp(x);
v = polyfit(log(x), log(y), 1); [exp(v(2)) v(1)]
v = polyfit(x, log(y), 1); [exp(v(2)) v(1)]
v = polyfit(log(x), log(y), 1); [v(2) v(1)]
v = polyfit(x, log(y), 1); [v(2) v(1)]