function [fitresult, gof] = createFit(a, b)
%CREATEFIT(A,B)
% Create a fit.
%
% Data for 'untitled fit 1' fit:
% X Input : a
% Y Output: b
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
% 另请参阅 FIT, CFIT, SFIT.
% 由 MATLAB 于 01-May-2016 22:45:07 自动生成
%% Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( a, b );
% Set up fittype and options.
ft = fittype( 'gauss1' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.Lower = [-Inf -Inf 0];
opts.Robust = 'Bisquare';
opts.StartPoint = [9 6 1.51816820741628];
% 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, 'b vs. a', 'untitled fit 1', 'Location', 'NorthEast' );
% Label axes
xlabel a
ylabel b
grid on
function [fitresult, gof] = createFit(a, b)
%CREATEFIT(A,B)
% Create a fit.
%
% Data for 'untitled fit 1' fit:
% X Input : a
% Y Output: b
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
% 另请参阅 FIT, CFIT, SFIT.
% 由 MATLAB 于 01-May-2016 22:45:07 自动生成
%% Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( a, b );
% Set up fittype and options.
ft = fittype( 'gauss1' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.Lower = [-Inf -Inf 0];
opts.Robust = 'Bisquare';
opts.StartPoint = [9 6 1.51816820741628];
% 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, 'b vs. a', 'untitled fit 1', 'Location', 'NorthEast' );
% Label axes
xlabel a
ylabel b
grid on
举报