function [] = lecture1( ) %LECTURE1 Jolie demo pour le cours % Vincent Legat -septembre 2011- % Version 0.0.0.alpha % Fully equipped of all standard options and ABS % See legal notices vincent.legat.eu % Be careful : do not use with alcohol close all X = [1 2 3]'; U = [4 5 1]'; scalarProduct = X'*U; exteriorProduc = X * U'; componentProduct = X.*U; A = [X.^0 X.^1 X.^2 ]; % % Do not do that, stupid boy ! % a = inv(A) * U % % Fine but boring :-) % a = A \ U % % % b = polyfit(X,U,2) plot(X,U,'r.','MarkerSize',25); hold on x = linspace(X(1),X(end),10)'; uh = [x.^0 x.^1 x.^2 ] * a plot(x,uh,'-b') vh = polyval(b,x) plot(x,vh,'-xb','MarkerSize',10) end