How to perform nonlinear regression accross multiple datasets
Show older comments
Appolgies in advance as I am new to MATLAB.
I am trying to fit a model to mutiple data sets at once using non linear regression. I have found similiar examples but I am unable to modify them to suit my needs.
The model contains 3 unkown paramaters that must be tuned to satsifty (or give best model fit) accross 4 data sets at once.However, the model also contains 1 known paramater which is different for each of the 4 datasets.
Model to fit:

- ΔRon/Ron are the data set y values
- t is the data set x values
- A1, A2, γ are unkown paramaters (common to all data sets) which must be found
- tau is a kown paramaer whcih differs accross all data sets
I have attached an m-file with relevant data and information. If sombody could provide guidance or a commented solution I would be very grateful. Thanks.
8 Comments
Star Strider
on 20 Feb 2021
Alex Sha
on 20 Feb 2021
Hi, Jack, how about the result below:
Root of Mean Square Error (RMSE): 2.95053109543145
Sum of Squared Residual: 1392.90139921726
Correlation Coef. (R): 0.990249551962065
R-Square: 0.98059417516107
Parameter Best Estimate
-------------------- -------------
A1 0.0408605886292576
A2 10.6063188291707
gamma 1.93086466662657E23
The overall results are not so good.
Dtat-1:

Data-2:

Data-3:

Data-4:

Jack Nolan
on 20 Feb 2021
Edited: Jack Nolan
on 20 Feb 2021
Alex Sha
on 20 Feb 2021
Hi, if taking tau as unknown parameter for each dataset, the result will be:
Root of Mean Square Error (RMSE): 0.14007204526557
Sum of Squared Residual: 3.13922845838077
Correlation Coef. (R): 0.997402065114036
R-Square: 0.994810879493743
Parameter Best Estimate
-------------------- -------------
A1 0.280360966183305
A2 13.4523349717593
Gamma 37464.657062153
tau (for dataset1) 2.4789258139085
tau (for dataset2) 4.89126227167148
tau (for dataset3) 68.7724316646379
tau (for dataset4) 0.660921515735491
Dataset1:

Dataset2:

Dataset3:

Dataset4:

The above results are obtained by 1stOpt, a package other than Matlab, the code looks like:
VarParameter Tau>0;
Variable x,y;
Function y=A1*log(1+x/tau)+A2*log(1+x/(gamma1*tau));
DataFile "CodeSheet1[A2:B41]";
DataFile "CodeSheet1[C2:D41]";
DataFile "CodeSheet1[E2:F41]";
DataFile "CodeSheet1[G2:H41]";
Datafile are stored as follow:

Jack Nolan
on 20 Feb 2021
Edited: Jack Nolan
on 20 Feb 2021
Alex Sha
on 20 Feb 2021
1stOpt is not free, but a comercal software: www.7d-soft.com/en
Jack Nolan
on 20 Feb 2021
Alex Sha
on 21 Feb 2021
Matlab should be OK, but need you to do more work.
Accepted Answer
More Answers (1)
Eleida
on 1 Jul 2025
0 votes
- (20%) Nonlinear Regression.
The data presented below follows the nonlinear functional relationship 𝑦 = 𝑥/(𝑎 + 𝑏𝑥), where 𝑎 and 𝑏 are the nonlinear model parameters.
Use MATLAB to complete the following:
Problem2.1. (5%) Linearize the dataset and perform linearregression on the linearized dataset.Display the slope and intercept/offset of the linear regression model, as well as its coefficient of determination.
Problem 2.2. (5%) Provide a plot that overlays the linearized dataset (i.e., linearized 𝑦 data vs linearized 𝑥 data) and the linear regression model obtained in problem 2.1. Display the linear regression model and its coefficient of determination in a legend. Include appropriate axes labels and axes grid lines.
Problem 2.3. (5%) Determine the values of the nonlinear model parameters 𝑎 and 𝑏 using the slope and intercept/offset of the linear regression model obtained in problem 2.1. Display the values of 𝑎 and 𝑏.
Problem 2.4. (5%) Provide a plot that overlays the original dataset and the nonlinear regression model obtained in problem 2.3. Display the nonlinear regression model and its coefficient of determination in a legend. Include appropriate axes labels and axes grid lines.
Categories
Find more on Contour Plots 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!