Multi Variable Non-linear Curve Fitting in MATLAB
Show older comments
Dear all,
I am trying to curve fit my objective variable "tau" which is called Ignition delay (unit, milli-sec). tau is modeled as a function of three variables as listed below
- Temperature, T (K),
- Pressure, P (atm), and
- Equivalence ration, phi (unitless)
The proposed curve-fitting equation has the following form. Here, a, b, c, d, e are the curve-fitting constant. And, here i = 3. Therefore, in total there is 15 curve-fitting constants.
tau(i) = ai * (p^bi) * (T^ci) * EXP(di / T) * (phi^ei)
Can anyone please suggest which MATLAB curve-fitting/regression tool should I use? Thanks in advance. I have attached a test data file if anyone is interested. Thanks.
****
Ultimate expression for the tau (if anyone is interested why i is set to be 3)
tau = (tau-1 + tau-2 + tau-3) / { (tau-1+tau-2) * tau-3 }
Accepted Answer
More Answers (3)
Hi,
i suggest to model this as a system of 4 equations with the 15 unknownse and use . 3 equations to calculate the tau(i) values and the 4th equation to calculate tau from the results of equations 1-3. Then subtract the measured value for tau from the result of equation 4. This is a job for fsolve.
Best regards
Stephan
Alex Sha
on 3 Aug 2019
0 votes
Root of Mean Square Error (RMSE): 1.09231944926872
Sum of Squared Residual: 1355.43178122881
Correlation Coef. (R): 0.999883881381431
R-Square: 0.999767776246396
Adjusted R-Square: 0.999766954942228
Determination Coef. (DC): 0.999758349281268
Chi-Square: 190.539760828559
F-Statistic: 331766.054300988
Parameter Best Estimate
---------- -------------
a1 0.509520813430713
b1 -0.410333298909599
c1 -1.88156624504009
d1 11326.3070797332
e1 -0.0582321791543802
a2 3.53682438415215E-6
b2 0.378224086620891
c2 -2.32994413523028
d2 19151.2160516163
e2 -0.0238944122916122
a3 2.16069394348543
b3 -0.87187579659814
c3 -0.258436168897444
d3 3550.15220868462
e3 -2.03331105345266


3 Comments
Star Strider
on 3 Aug 2019
Please post the complete code that produced those parameter estimates.
harsh Brar
on 9 May 2022
Hey Alex sha... Can you please share the code?
Pedro Machado
on 18 Jul 2022
S0852306
on 23 Jul 2023
Try this: Multivariable surface fitting
The fitted surface matches your data quite well:
root mean square error : 0.1482
sum of square error : 24.9477
mean absolute error : 0.0971


clear; clc; close all;
T=readtable("Data_Source.xlsx");
%%
data(1,:)=T.Equiv_Ratio_Phi';
data(2,:)=T.Pressure_P_atm_';
data(3,:)=T.Temperature_T_K_';
label=T.IDT_Tau_milli_sec_';
%%
NN.InputAutoScaling='on'; NN.LabelAutoScaling='on';
InSize=3; OutSize=1;
LayerStruct=[InSize,10,10,10,OutSize];
NN=Initialization(LayerStruct,NN);
%%
option.MaxIteration=1500;
NN=OptimizationSolver(data,label,NN,option);
Stats
R=FittingReport(data,label,NN);
%%
figure
p=NN.Evaluate(data); % use this function to evaluate fitted model
plot(label,'.')
hold on
plot(p)
legend('target value','fitted n-d surface')
% SSE=sum(R.ErrorVector.^2); % MSE=mean(R.ErrorVector.^2); % RMSE=sqrt(MSE)
The model I used is a neural net, it's a universal approximator (able to approximate any continuous function given
enough parameters), although it has a fancy name, its mathematical model is actually quite simple.
Detail math info can be found at file exchange website.
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!