-
Notifications
You must be signed in to change notification settings - Fork 0
/
richardsonFit.m
41 lines (33 loc) · 1.21 KB
/
richardsonFit.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
function [fitresult, gof] = richardsonFit(xtest, ytest, ztest)
%CREATEFIT(XTEST,YTEST,ZTEST)
% Create a fit.
%
% Data for 'richardsonFit' 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 11-Nov-2021 10:02:07
%% Fit: 'richardsonFit'.
[xData, yData, zData] = prepareSurfaceData( xtest, ytest, ztest );
% Set up fittype and options.
ft = fittype( 'richardson(x, y, a, b, c)', 'independent', {'x', 'y'}, 'dependent', 'z' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [10 10 10];
% Fit model to data.
[fitresult, gof] = fit( [xData, yData], zData, ft, opts );
% Plot fit with data.
%figure( 'Name', 'richardsonFit' );
%h = plot( fitresult, [xData, yData], zData );
%legend( h, 'richardsonFit', 'ztest vs. xtest, ytest', 'Location', 'NorthEast', 'Interpreter', 'none' );
% Label axes
%xlabel( 'xtest', 'Interpreter', 'none' );
%ylabel( 'ytest', 'Interpreter', 'none' );
%zlabel( 'ztest', 'Interpreter', 'none' );
%grid on
%view( -37.3, 7.1 );