how can I fit nonlinear regression equations with a set of data

1 view (last 30 days)
Hello everybody
I’m trying to find a nonlinear relationship between two input variables and one dependent variable (output). I do have a set of data that have three columns, the first two columns are the input variables and the third one is the output value. Any suggestion to figure out that? I have tried to use the regression and classification apps in the Matlab.
The attached file is a part of this data.
Thank you

Accepted Answer

Star Strider
Star Strider on 5 Feb 2020
Edited: Star Strider on 5 Feb 2020
There is no relationship. Every value in the third column is uniformly 1:
T = readtable('data1.xlsx','ReadVariableNames',0);
UT3 = unique(T{:,3})
producing:
UT3 =
1
With ‘data2.xlsx’, you can fit anything you want to those data, depending on what they represent and the process that created them.
Two possibilities, both using linear regression:
T = readtable('data2.xlsx','ReadVariableNames',0);
xv = linspace(min(T{:,1}), max(T{:,1}), 20);
yv = linspace(min(T{:,2}), max(T{:,2}), 20);
[Xm,Ym] = ndgrid(xv, yv);
DM1 = [T{:,[1 2]}, ones(size(T{:,1}))];
B1 = DM1 \ T{:,3};
zv1 = [Xm(:), Ym(:), ones(size(Xm(:)))] * B1;
Zm1 = reshape(zv1, size(Xm));
DM2 = [T{:,1}, 1./T{:,2} ones(size(T{:,1}))];
B2 = DM2 \ T{:,3};
zv2 = [Xm(:), 1./Ym(:), ones(size(Xm(:)))] * B2;
Zm2 = reshape(zv2, size(Xm));
figure
stem3(T{:,1}, T{:,2}, T{:,3})
hold on
mesh(Xm, Ym, Zm1)
hold off
grid on
xlabel('X')
ylabel('Y')
zlabel('Z')
figure
stem3(T{:,1}, T{:,2}, T{:,3})
hold on
mesh(Xm, Ym, Zm2)
hold off
grid on
xlabel('X')
ylabel('Y')
zlabel('Z')
The best fit will be to estimate the relevant parameters of a mathematical model of the process that created them. Beyond that, you can fit anything to them.

More Answers (2)

Mohanned Al Gharawi
Mohanned Al Gharawi on 5 Feb 2020
@ Star Strider
Sorry for that, I just updated the data set.
Thanks

Mohanned Al Gharawi
Mohanned Al Gharawi on 5 Feb 2020
Thank you so much I appreciate your help.

Categories

Find more on Fit Postprocessing 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!