-
Notifications
You must be signed in to change notification settings - Fork 0
/
carryingCapFit.m
42 lines (34 loc) · 1.31 KB
/
carryingCapFit.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function [fitresult, gof] = carryingCapFit(xtest, ytest, ztest, guess)
%CREATEFIT(INDIA,PAKI,INDIADER)
% Create a fit.
%
% Data for 'carryingCapFit' fit:
% X Input : xtest
% Y Input : ytest
% Z Output: ztest
% Guess on max : guess
% 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 22-Nov-2021 10:45:07
%% Fit: 'carryingCapFit'.
[xData, yData, zData] = prepareSurfaceData( xtest, ytest, ztest );
% Set up fittype and options.
ft = fittype( 'carryingCap(x,y,a,b,c,d)', 'independent', {'x', 'y'}, 'dependent', 'z' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [guess 0.267645588129181 0.254181515435816 0.913375856139019];
% Fit model to data.
[fitresult, gof] = fit( [xData, yData], zData, ft, opts );
% Plot fit with data.
%figure( 'Name', 'carryingCapFit' );
%h = plot( fitresult, [xData, yData], zData );
%legend( h, 'carryingCapFit', 'indiaDer vs. india, paki', 'Location', 'NorthEast', 'Interpreter', 'none' );
% Label axes
%xlabel( 'india', 'Interpreter', 'none' );
%ylabel( 'paki', 'Interpreter', 'none' );
%zlabel( 'indiaDer', 'Interpreter', 'none' );
%grid on
%view( -3.6, 9.1 );