-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateFit_gpp.m
More file actions
46 lines (39 loc) · 1.12 KB
/
createFit_gpp.m
File metadata and controls
46 lines (39 loc) · 1.12 KB
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
43
44
45
46
function [fitresult, gof] = createFit(a1, b1,cc)
%CREATEFIT(A1,B1)
% Create a fit.
%
% Data for 'untitled fit 1' fit:
% X Input : a1
% Y Output: b1
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
% 鍙﹁鍙傞槄 FIT, CFIT, SFIT.
% 鐢? MATLAB 浜? 06-Jun-2023 20:43:45 鑷姩鐢熸垚
%% Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( a1, b1 );
% Set up fittype and options.
ft = fittype( 'exp(b*(x-c)*(x-c)+d)', 'independent', 'x', 'dependent', 'y' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
b = 25.2;
opts.Lower = [-Inf b -Inf];
opts.StartPoint = [-0.0056 b 2];
opts.Upper = [0 b Inf];
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
if cc==1
% if fitresult.a1 >-9000
% Plot fit with data.
% figure( 'Name', 'untitled fit 1' );
h = plot( fitresult, xData, yData );
% h = plot( fitresult);
legend( h, 'Temp vs. ER', 'untitled fit 1', 'Location', 'NorthEast' );
% Label axes
xlabel Temp
ylabel ER
grid on
hold on
% end
end