Curve fitting tool with 4 variables

32 views (last 30 days)
Yueqian Ma
Yueqian Ma on 7 May 2019
Commented: Alex Sha on 6 Dec 2019
I'm trying to predict soil respiration using 4 known vectors (x, y, z, and k) using the equation:
k = a*exp(b*x)*exp(c*y+d*y^2)+e*z+f
I tried looking online, but each problem uses 2 or 3 variables from the curve fitting tool. How can I do 4 variables?
Thanks in advance for any help.

Answers (3)

Alex Sha
Alex Sha on 24 May 2019
Attach your data file please.
  2 Comments
Mahesh Karki
Mahesh Karki on 27 May 2019
Edited: Mahesh Karki on 27 May 2019
Hi Alex,
I have the same question and I have attached the data file below.
Here,
X1, X2 and X3 are the Independent Variable while Y1 is the dependent Variable and I don't have the fit equation.
I have also read the Matlab answers in similar topics, link atatched below:
Do you have any suggestions?
Mahesh
Yueqian Ma
Yueqian Ma on 27 May 2019
Edited: Yueqian Ma on 27 May 2019
Like what the previous comments said, if you don't have a model, then you can't find any unknowns within the equation because there's literally an infinite amount of fits. I suggest you use the regression learner app in matlab to train and find a suitable model.

Sign in to comment.


Alex Sha
Alex Sha on 28 May 2019
Hi, Mahesh, if you don't care the formation of the fitting equation, try the follows:
y = sin((((((p1-x3)^2)*x3)/(((x3^2)^(x2^p2))/exp(sin(((p3/(1+x3)^0.5)/(1+p4/x1))/(p5/(1-x3))))))*((1+x1)^0.5+x2^2))/(1/(p6-x2)^2))-(1/(p7+x2)-(1+p8/x3)+(x1+1)^p9);
Root of Mean Square Error (RMSE): 0.000948905304490633
Sum of Squared Residual: 1.08050553226855E-5
Correlation Coef. (R): 0.999562780052203
R-Square: 0.999125751265689
Adjusted R-Square: 0.998626180560369
Determination Coef. (DC): 0.999121540217668
Chi-Square: 1.52267545487959E-5
F-Statistic: 428.261316945475
Parameter Best Estimate
---------- -------------
p1 4.60817694964176
p2 0.774217015206445
p3 -125.052492026267
p4 98.1254106271433
p5 0.61282127680523
p6 2133.5891967895
p7 -7.82339269347936
p8 -2.25961768228283
p9 -0.56287172661848
c161.jpg
  1 Comment
Mahesh Karki
Mahesh Karki on 28 May 2019
Edited: Mahesh Karki on 28 May 2019
Hi Alex,
Thanks for your solution, I am interested to know how you find the fit equation, can you share the script.
Mahesh

Sign in to comment.


Ashok Kurakula
Ashok Kurakula on 6 Dec 2019
Edited: Ashok Kurakula on 6 Dec 2019
Hi Alex,
Appriciate !!
In whole seach of mine, I didn't see one helping curve fitting more than 3 variables, you are the one who puts up sollution.
I do have the similar work for dynamically varing data, since data would keep chaging single equation wouldn't help me. I have 3 indipent variables and 1 dependent variable.
Great, if you could help me here. I would not need the code as on, but path to get a solution for my problem.
Thanks & Regards,
Ashok Kurakula.

Community Treasure Hunt

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

Start Hunting!