Hi.
I have 6 independent variable and one dependent variable. I want to fit a response surface to the data by for exp a second order polynomial, when I open curve fitting toolbox, There is only two space for the input variable. can anyone help me about this. How can I do this fit in matlab?
Thank you in advance for your time.

 Akzeptierte Antwort

darova
darova am 2 Mär. 2020

1 Stimme

Look here

4 Kommentare

Arash
Arash am 3 Mär. 2020
Thank you for your help, But if I understand correctly, this means that I must know the form of the equation and it will compute for me the coefficient of the equation. Is there any way that matlab fits a surface based on any algorithm (not linear) to my data?
darova
darova am 3 Mär. 2020
Of course! Look this:
Arash
Arash am 4 Mär. 2020
Here you have two independent variable X and Y and Z as the dependent variable. How can I apply this to a four independent variable for example [x1 x2 x3 x4 ];
I don't know my equation to use the custom option. I want to get the euqation from thisw method [polynomial with degree of 2] from my data.
darova
darova am 4 Mär. 2020
fit toolbox can't handle such task. Maybe you want griddedInterpolant

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Thonn Homsnit
Thonn Homsnit am 10 Mai 2022

0 Stimmen

I faced the same problem as the author. But I have just figured it out !
I use the 'fitnlm' function with the user defined function with handle like this
modelFun = @(b1,x1)( ...
+b1(1).*x1(:,1) ...
+b1(2).*x1(:,2) ...
+b1(3).*x1(:,3)...
+b1(4).*x1(:,4)...
+b1(5).*x1(:,1).*x1(:,2) ...
+b1(6).*x1(:,1).*x1(:,3) ...
+b1(7).*x1(:,1).*x1(:,4) ...
+b1(8).*x1(:,2).*x1(:,3) ...
+b1(9).*x1(:,2).*x1(:,4) ...
+b1(10).*x1(:,3).*x1(:,4) ...
+b1(11).*x1(:,1).*x1(:,1) ...
+b1(12).*x1(:,2).*x1(:,2) ...
+b1(13).*x1(:,3).*x1(:,3) ...
+b1(14).*x1(:,4).*x1(:,4) ...
+b1(15) ...
);
beta0 = zeros(15,1); %%% initial coefficient value %%%%
mdl1 = fitnlm(x1,y1,modelFun,beta0);
b1 = table2array(mdl1.Coefficients(:,"Estimate"));
x1 is predictor matrix and y1 is target vector. you can solve the b1 matrix which is the coefficient of this function. Another tool is using MBC toolbox. But the documentation is very old and i cannot find the algorithm behind the toolbox.
Hope it helps.

Kategorien

Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 2 Mär. 2020

Beantwortet:

am 10 Mai 2022

Community Treasure Hunt

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

Start Hunting!

Translated by