% Demo of polyfit function
% Vary the degree of the poynomial to see the effect
% Minas Spetsakis, Nov. 2017


X=[1 3  5   6  7 9 13]
Y=[2 10 10 -1 -2 0 7]

p=polyfit(X,Y,6 )

fplot(@(x)polyval(p,x),[.9 13.01]);
hold on
plot(X,Y,'r');
hold off
