function [fitresult, gof] = createFit(SA, FY)
%CREATEFIT(SA,FY)
%  Create a fit.
%
%  Data for 'untitled fit 1' fit:
%      X Input: SA
%      Y Output: FY
%  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 04-Jan-2024 14:49:41


%% Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( SA, FY );

% Set up fittype and options.
ft = fittype( 'fourier8' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.MaxFunEvals = 100000;
opts.MaxIter = 50000;
opts.StartPoint = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7.29927003160889];

% 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, 'FY vs. SA', 'untitled fit 1', 'Location', 'NorthEast', 'Interpreter', 'none' );
% % Label axes
% xlabel( 'SA', 'Interpreter', 'none' );
% ylabel( 'FY', 'Interpreter', 'none' );
% grid on