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?

采纳的回答

Torsten
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 CenterFile Exchange 中查找有关 Linear and Nonlinear Regression 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by