function [fitresult, gof] = createFit(allPressuresDecr, allTempDecr, allVrsDecr)
%CREATEFIT(ALLPRESSURESDECR,ALLTEMPDECR,ALLVRSDECR)
%  Create a fit.
%
%  Data for 'allDecrFit' fit:
%      X Input: allPressuresDecr
%      Y Input: allTempDecr
%      Z Output: allVrsDecr
%  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 08-Dec-2023 11:42:26


%% Fit: 'allDecrFit'.
[xData, yData, zData] = prepareSurfaceData( allPressuresDecr, allTempDecr, allVrsDecr );

% Set up fittype and options.
ft = 'linearinterp';
opts = fitoptions( 'Method', 'LinearInterpolant' );
opts.ExtrapolationMethod = 'none';

% Fit model to data.
[fitresult, gof] = fit( [xData, yData], zData, ft, opts );

% Plot fit with data.
figure( 'Name', 'allDecrFit' );
h = plot( fitresult, [xData, yData], zData );
legend( h, 'allDecrFit', 'allVrsDecr vs. allPressuresDecr, allTempDecr', 'Location', 'NorthEast', 'Interpreter', 'none' );
% Label axes
xlabel( 'allPressuresDecr', 'Interpreter', 'none' );
ylabel( 'allTempDecr', 'Interpreter', 'none' );
zlabel( 'allVrsDecr', 'Interpreter', 'none' );
grid on


