I am looking for a method to fit two different datasets with different fit models but depending on the same parameters in Matlab. All solutions i found so far are either not for matlab or do not treat this exact problem.
Here is a rough example what my problem looks like: I have acquired two datasets that should take these forms:
Dataset 1: f(x) = a*exp(x)+b
Dataset 2: g(x) = atan(b*x/a)
The real formulas are more complicated but the principle should be the same.
When i try to fit them with a NonlinearLeastSquares independently, matlab obviously provides different values for the variables a
and b
for the two different datasets. I tried feeding one solution into the other fitting routine as a starting point but that rarely improves accuracy. Is there a way to tell Matlab to fit both datasets at the same time or at least find the variables that fit bost models the best?