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

조회 수: 1 (최근 30일)
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

채택된 답변

Star Strider
Star Strider 2020년 2월 5일
편집: Star Strider 2020년 2월 5일
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.

추가 답변 (2개)

Mohanned Al Gharawi
Mohanned Al Gharawi 2020년 2월 5일
@ Star Strider
Sorry for that, I just updated the data set.
Thanks

Mohanned Al Gharawi
Mohanned Al Gharawi 2020년 2월 5일
Thank you so much I appreciate your help.

카테고리

Help CenterFile Exchange에서 Fit Postprocessing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by