formula for nonlinear regression model

1 view (last 30 days)
Dear MatLab Experts,
I have four column vectors with 14 elements representing respectively:
Area, Max.Diameter, Min.Diameter, Field Size Factor (FSF) of custom-made collimators.
I believe the FSF depends somehow on the other three quantities. The dependence is not linear.
I woud like to tryto model the FSF as a power law involving products of the other quantities.
For instance, FSF ~a*(Max.Diam*Min.Diam)^b + c*(Area/Max.Diam)^d + e*(Area/Min.Diam)^f + g*(Max.Diam/Min.Diam)^h + i
where a, b,c,d,e,f,g,h,i are the unknown model coefficients.
I am pretty sure most of the terms are useless. Perobably just one is necessary for the model. However, I do not know which one is the most important term. I expect the modeling function will figure that out.
My problem is that I do not know how to write the above formula in the proper format expected by the nonlinear regression functions.
I need some help to set up the above outlined particular model.
Thank you very much in advance.
Best regards,
Maura E. M.

Accepted Answer

SYED IMTIAZ ALI SHAH
SYED IMTIAZ ALI SHAH on 14 Aug 2019
Is this what you want?
x = MaxFDiam .* MinFDiam + Area ./ MaxFDiam + Area ./ MinFDiam + MaxFDiam ./ MinFDiam; % your formula
Linear model Poly7:
Your resultant equation with coefficients.
f(x) = p1*x^7 + p2*x^6 + p3*x^5 + p4*x^4 + p5*x^3 +
p6*x^2 + p7*x + p8
Coefficients (with 95% confidence bounds):
p1 = 2.961e-18 (-5.495e-18, 1.142e-17)
p2 = -6.914e-15 (-2.189e-14, 8.064e-15)
p3 = 6.708e-12 (-4.044e-12, 1.746e-11)
p4 = -3.496e-09 (-7.522e-09, 5.297e-10)
p5 = 1.054e-06 (2.132e-07, 1.895e-06)
p6 = -0.0001832 (-0.0002798, -8.656e-05)
p7 = 0.01691 (0.01138, 0.02244)
p8 = 0.3618 (0.2454, 0.4782)
Goodness of fit:
SSE: 5.048e-06
R-square: 0.9998
Adjusted R-square: 0.9995
RMSE: 0.0009173
1.PNG
2.PNG
  4 Comments
Maura E. Monville
Maura E. Monville on 14 Aug 2019
Yes. The coefficients are very small. But the fit is close to perfection.
I have sdeveloped a Monte Carlo simulation that reproduces the trend of the experimental measurements but not as accurately as your model.
I tried to fit a much simpler linear model using 'fitlm'. The result was bad although the R^2 was more than 0.9. But some P_values were 'NaN'.
I am going to accept your very good solution. Although I really would like to learn how to play with nonlinear models.
Thank you.
Regards,
maura E. M.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!