% disp(sprintf('**** Examples from Chapter 07 ****'));

% disp(sprintf('**** Example 7.1 Monomial Basis *'));
%%%% Use quadratic monomial interpolation.
% Find coefficients x_i for data given:
% t=[-2 0 1]';	    % independent variable
% y=[-27 -1 0]';	% measured data values
% Evaluate and plot interpolating polynomial on the interval of interest.
% Plot also all tree data points.

% disp(sprintf('**** Example 7.x Legendre Polynomials as Basis*'));
%%%% Use Legendre orthogonal basis polynomial for interpolation of data 
% from Example 7.1 and explain the result obtained.

% disp(sprintf('**** Example 7.4 Incremental Newton Interpolation *'));
%%%% Start with the first data point and build the polynomials of higher order 
% by adding further data points. Use the same data as before. Compare the obtained
% interpolating polynomial by previous examples.

% disp(sprintf('**** Example 7.6 Cubic Spline Interpolation *'));
%%%% Use a piecewise natural cubic spline interpolation for the same
% data points as in the previous examples. Construct and solve the appropriate system of
% equations. Plot your result on the plot from example 7.1.

% Interpolate 5 non-equidistant data points
% t=[-2 0 1 2 2.5 ]';	% independent variable
% y=[-27 -1 0 -4 10]';	% measured data values
% by monomial basis and by natural cubic spline. Plot both interpolants and data points!
% Use Matlab function "polyfit" to test your results. Use also functions "spline" and "ppval"
% to generate and evaluate Matlab splines. Plot Matlab solutions and compare your results.

