%
% Main-Programm zur Aufgabe 4, Serie 2
%
% Vorlesung "Einfuerung in die Numerik", Uni Basel, FS 11
%

clear all
close all

xs = 0 : 0.2 : 1;

for i = 1 : length(xs)-1
    x = xs(i) : 0.01 : xs(i+1);
    
    l=LinInterpol(xs(i), xs(i+1), x);
    q=QuadInterpol(xs(i), xs(i+1), x);
    subplot(1,2,1), hold on
    plot(x, f(x), 'k-', x, l, 'k-.'), axis([-0.03 1.03 -1.03 1.53]), title('Stueckweise lin. Interpol.')
    
	subplot(1,2,2), hold on
    plot(x, f(x), 'k-', x, q, 'k-.'), axis([-0.03 1.03 -1.03 1.53]), title('Stueckweise quad. Interpol.')
end
