Simultanous curve fitting to multiple datasets
9 ビュー (過去 30 日間)
古いコメントを表示
I want to fit a nonlinear model simultaneously to multiple experimental datasets from different publications.
Besides the dependency of the model equation on the curve fitting parameters(a,b,c), my model also depends on an experimental variable, which defines the loading velocity of the experiment.
The loading velocity is different for each experiment and directly influences the model response. It is predefined and shall not be used for curve fitting.
The following sample data and model function is considered:
x1 = 0:0.1:1;
x2 = 0.05:0.1:0.75;
fun = @(x,a,b,c,velocity) a+b*x+velocity*exp(c.*x);
a_hat=1; b_hat=1; c_hat=1;
y1 = fun(x1, a_hat, b_hat, c_hat, 1.1)+(0.5-rand(1,length(x1)));
y2 = fun(x2, a_hat, b_hat, c_hat, 0.9)+(0.5-rand(1,length(x2)));
What is the best way to get one set of parameters, which fits both experiments?
0 件のコメント
採用された回答
Torsten
2022 年 3 月 12 日
x1 = 0:0.1:1;
x2 = 0.05:0.1:0.75;
fun = @(x,a,b,c,velocity) a+b*x+velocity.*exp(c.*x);
a_hat=1; b_hat=1; c_hat=1;
y1 = fun(x1, a_hat, b_hat, c_hat, 1.1)+(0.5-rand(1,length(x1)));
y2 = fun(x2, a_hat, b_hat, c_hat, 0.9)+(0.5-rand(1,length(x2)));
x = [x1,x2];
y = [y1,y2];
fun_optim = @(p) fun(x,p(1),p(2),p(3),[1.1*ones(size(x1)),0.9*ones(size(x2))]) - y;
sol = lsqnonlin(fun_optim,[1;1;1])
Note that I changed your original fun from
fun = @(x,a,b,c,velocity) a+b*x+velocity*exp(c.*x);
to
fun = @(x,a,b,c,velocity) a+b*x+velocity.*exp(c.*x);
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Linear and Nonlinear Regression についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!