Curvefitting a given function with parameters to pass through given points
古いコメントを表示
I need to curve fit a given data with a function which contains a few parameters. I need to find the values of those parameters. But I need the curve to pass through certain given points too. How do I do this
2 件のコメント
Birdman
2018 年 6 月 6 日
Can you share your given data and your function?
AAKILA RAJAN
2018 年 6 月 6 日
回答 (1 件)
Torsten
2018 年 6 月 6 日
0 投票
Each prescribed point on the curve gives you a relation between the parameters to be estimated. These relations are constraints for the curve fitting process. You can use MATLAB's "fmincon" together with the "nonlcon" function for nonlinear constraints or the Aeq,beq arrays for linear constraints.
Best wishes
Torsten.
3 件のコメント
AAKILA RAJAN
2018 年 6 月 6 日
Torsten
2018 年 6 月 6 日
Example:
If
p(x)=a*x^2+b*x+c+d*exp(e*x)
is the form of the fitting function and you want to have p(xend) to have a specified value yend, you get the constraint
yend - (a*xend^2+b*xend+c+d*exp(e*xend)) = 0
This constraint has to be implemented in fmincon's "nonlcon" as
ceq(1) = yend - (p(1)*xend^2+p(2)*xend+p(3)+p(4)*exp(p(5)*xend))
And the objective function for the problem is the sum of squared differences between measured and fitted data.
Best wishes
Torsten.
AAKILA RAJAN
2018 年 6 月 6 日
カテゴリ
ヘルプ センター および File Exchange で Get Started with Curve Fitting Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!