Adding a condition to the non-linear least square curve fitting
Show older comments
Hello everyone,
I have a question regarding curve fitting using nonlinear regression.
My aim is to calculate three model parameters (a,b,c) out of measurement data to create a physical model. It is a polynomial model with the equation: y=a*x^2+b*x+c
To ensure the physical meaningfulness, the parameters must furthermore fulfill the condition: a+b+c=1
My present code is:
options = fitoptions('Method', 'LinearLeastSquares')
[f_p_zip,g_p_zip]=fit(v_pu,p_pu,'poly2',options);
Unfortunately I cannot find a way to add the condition into the regression process.
Have you an idea how to solve this problem?
Thank you very much in advance,
Kind regards,
Steffi
2 Comments
Alex Sha
on 9 Jun 2021
Hi, take "c=1-a-b" into your fitting function, the your function will be become as: y=a*x^2+b*x+1-a-b, in such case, you don't need to consider any other condition.
Stefanie Lösch
on 10 Jun 2021
Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox 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!