function [ z ] = func_Spline3_Coef( n, t, y )
%FUNC_SPLINE3_COEF Find the Coeficients of the spline determined by 
%   the point arrays t & y
%       Inputs
%   n = # of intervals = knots - 1
%   t = the array of "x" point values
%   y = the array of "y" point values
%       Outputs
%   z = the Coeficients for the spline


for i = 1:n;
    h(i) = t(i+1)-t(i);
    b(i) = (y(i+1) - y(i))/h(i);
end
u(1) = 2*(h(1) + h(2));
v(1) = 6*(b(2) - b(1));
for i = 3:n
    u(i-1) = 2*(h(i) + h(i-1)) - (h(i-1)^2)/u(i-2);
    v(i-1) = 6*(b(i) - b(i-1)) - (h(i-1)*v(i-2))/u(i-2);
end
z(n+1) = 0;
for i = n:-1:2;
    z(i) = (v(i-1) - h(i)*z(i+1))/u(i-1);
end
z(1) = 0;
end

