TransWikia.com

Simultaneous fitting of two function with two data sets with same set of parameters

Mathematica Asked on February 27, 2021

I am trying to fit two functions with two data sets simultaneously and the function is basically the real and imaginary part of the Lorentzian, I have the dataset which you can find in the link here Dataset, it has 3 columns, first is frequency, 2nd is the Real part and the 3rd column is the imaginary part.

I have defined my functions as

modelImag = ((a*(f^2 - x^2))/((f^2 - x^2)^2 + (d^2*x^2)));
modelReal = (((a*(d*x))/((f^2 - x^2)^2 + ((d)^2*x^2))));

Please not that I can fit the my data indiviudually but the paametess value are different for both case, in practice same set of parmeters should fit both functions.
I have taken my dataset as

Data = Import["E:ShelendercodesMathematicaQa.csv"];
dataReal = Data[[All, {1, 3}]];
dataImag = Data[[All, {1, 2}]];
data = Flatten[{{1, #[[1]], #[[2]]} & /@ 
    dataReal, {0, #[[1]], #[[2]]} & /@ dataImag}, 1]
nlm = NonlinearModelFit[
   data, {modelReal + modelImag}, {{a, 1.0*10^7}, {f, 10.0*10^6}, {d, 
     33000}}, {a, x}];

I think I have some problem while non-linear model fit.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP