Nonlinear data fitting using lsqnonlin for multiple variables
52 次查看(过去 30 天)
显示 更早的评论
Hello I am trying to fit multiple variables with multiple parameters and objective functions to experimental data using lsqnonlin function and I am having difficulty to generalize the code for this.
For example consider x1, x2, x3 and x4 as the 4 variables that I want to fit. The input data/parameters is a matrix 10x2 where each column is a independent variable a and b having 10 data points corresponding to the output data Y. further I have 2 objective functions f1 and f2.
The first 5 datapoints correspond to the output with respect to variables x1 x2 and their objective function f1. The next 5 data points correspond to the output with respect to variables x3 x4 and their objective function f2 as below
f1 = (x1 + x2*a(1:5) + b*x2(1:5)^3) - y(1:5)
f2 = (x3 + x4*a(5:10) + x4*b(5:10)^2) - y(5:10)
The number of variables, parameters and functions in this expample is just for explanation and in practice may be more.
Kindly suggest how I can generalize to code to accept multiple variables, parameters and functions.Also the function above is hypothetical, so you may use a different function in your answers
Thank you
1 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fit Postprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!