% Skript zur Musterlösung
%
% Numerische Mathematik, SS 2013
%
% Polynominterpolations vs. Splines
%
% Ingolf Busch, Juli 2013

x = [ 0.9 1.3 1.9 2.1 2.6 3.0 3.9 4.4 4.7 5.0 6.0 7.0 8.0 9.2 10.5 11.3 11.6 12.0 12.6 13.0 13.3];
y = [1.3 1.5 1.85 2.1 2.6 2.7 2.4 2.15 2.05 2.1 2.25 2.3 2.25 1.95 1.4 0.9 0.7 0.6 0.5 0.4 0.25];



%f = my_div_diff(x,y);
p = polyfit(x,y,length(x)-1);
mu = my_spline_kub(x,y,'N');

t=linspace(min(x),max(x),1000);

%plot(x,y,'r*',t,my_horner_newton(f,x,t),t,my_spline_eval(x,y,mu,t)),axis([ 0 15 -4 8]);
plot(x,y,'r*',t,polyval(p,t),t,my_spline_eval(x,y,mu,t)),axis([ 0 15 -4 8]);