Simultanous curve fitting to multiple datasets

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?

 채택된 답변

Torsten
Torsten 2022년 3월 12일

0 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

질문:

2022년 3월 12일

댓글:

2022년 3월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by