-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecoConstraintFit.m
42 lines (34 loc) · 1.33 KB
/
ecoConstraintFit.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] = ecoConstraintFit(xtest, ytest, ztest)
%CREATEFIT(INDIA,PAKI,INDIADER)
% Create a fit.
%
% Data for 'ecoConstraintFit' fit:
% X Input : xtest
% Y Input : ytest
% Z Output: ztest
% 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-Nov-2021 20:53:30
%% Fit: 'ecoConstraintFit'.
[xData, yData, zData] = prepareSurfaceData(xtest, ytest, ztest);
% Set up fittype and options.
ft = fittype( 'ecoConstraint(x,y,a,b,c,d)', 'independent', {'x', 'y'}, 'dependent', 'z' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.171186687811562 0.0706046088019609 0.0318328463774207 0.27692298496089];
opts.Lower = [0 0 -Inf -Inf];
% Fit model to data.
[fitresult, gof] = fit( [xData, yData], zData, ft, opts );
% Plot fit with data.
% figure( 'Name', 'ecoConstraintFit' );
% h = plot( fitresult, [xData, yData], zData );
% legend( h, 'ecoConstraintFit', '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( -4.3, 6.7 );