function ex10()
in = load("cp.dat");
t = in(:,1);
cp = in(:,2);
t1 = 15;

tI = min(t)-0.3:0.1:max(t)+0.3;  % Werte zum Plotten

% Polynom
poly = polyfit(t, cp, length(t)-1);
fprintf("Polynomkoeffizienten: \n");
fprintf("  %10.3e\n", poly);
cpP = polyval(poly, tI);

% Spline
cpS = interp1(t, cp, tI, "spline");

% Plot
set(0,"defaultfigurecolor","white");
plot(t, cp, "r*", t, cp, "k-", tI, cpS, "b-")
hold("on")
plot(tI, cpP, "Color", [0 0.5 0])
hold("off")
ylim([4.16 4.29]);
xlabel("t [°C]","FontSize",12);
ylabel("c_p [kJ/(kg K)]","FontSize",12);
legend("Messpunkte", "linear", "Spline", "Polynom", ...
       "Location", "northwest");

F = getframe(gcf);
imwrite(F.cdata, "bild25.png");

% Wert bei t1
cpP1 = polyval(poly, t1);
cpL1 = interp1(t, cp, t1, "linear");
cpS1 = interp1(t, cp, t1, "spline");

fprintf("\nWert bei %4.1f:  linear   Polynom  Spline\n", t1);
fprintf("                %6.4f   %6.4f   %6.4f\n", cpL1, cpP1, cpS1);
