function [fitresult, gof] = createFit(z1, c1)
%CREATEFIT(Z1,C1)
% Create a fit.
%
% Data for 'untitled fit 1' fit:
% X Input : z1
% Y Output: c1
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
% See also FIT, CFIT, SFIT.
% Auto-generated by MATLAB on 30-Jan-2013 10:59:24
% David Willingham February 2013
% Copyright 2013 The MathWorks, Inc
%% Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( z1, c1 );
% Set up fittype and options.
ft = fittype( 'splineinterp' );
opts = fitoptions( ft );
opts.Normalize = 'on';
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
% Plot fit with data.
% figure( 'Name', 'untitled fit 1' );
h = plot( fitresult, xData, yData );
legend( h, 'Original Cu Perc', 'Interpolated Cu Perc', 'Location', 'NorthEast' );
% Label axes
xlabel( 'Elevation' );
ylabel( 'Cu Perc' );
grid on