% m7_expansions.m - coefficients and expansions A = [1 2 3; 4 5 6; 2 2 0] A*[1;0;1] A*[1;-2;0] inv(A)*[2;2;2] A\[2;2;2] t = (0:.1:2)' plot(t,exp(-t),'r'), grid on A = [t.^0 t.^1 t.^2] % this is called a Vandermonde matrix x = [1; -1; 1/2] hold on, plot(t,A*x,'--b') x = A\exp(-t) % backslash for rectangular A: least-squares approx. plot(t,A*x,'--k') legend('exp(-t)','Taylor','least-squares','location','southwest') hold off, plot(t,A*x-exp(-t)), grid on