Hello,
I am looking for a way to do a curve fitting by using several simultaneous implicit equations (and I couldn’t make this work with FindFit). Attached is an notebook that I prepared for generating a plotting the data of the following coupled equations and NSolve
NSolve[{10^pK1 == HD/(H*D), 10^pK2 == HG/(H*G), Ha == HD + HG + H,
Ga == HG + G, Da == HD + D}, {HD, HG, H, G, D}]
It followed making solution matrix for discrete values of Ga and picking out the correct parts of the solution of HD, HG, H, G and D that are real and fulfill some conditions given pK1, pK2, Ha and Da as fixed values, and Ga as the independent variable,
I have now the problem that I would like to do the opposite: Given a data list of the form {Ga, HD}, I would like fit the parameters pK1 and Ha, which best fulfill the equations 10^pK1 == HD/(HD), 10^pK2 == HG/(HG), Ha == HD + HG + H,
Ga == HG + G, Da == HD + D as above.
For instance, the 20-point data list (Ga, HD) below was created with Ha = 1, Da =1, pk1 = 2 and pK2 =3.
{{1.*10^-8, 0.904875}, {0.05, 0.878427}, {0.1, 0.846593}, {0.15,
0.81062}, {0.2, 0.7719}, {0.25, 0.731591}, {0.3, 0.690551}, {0.35,
0.649405}, {0.4, 0.608618}, {0.45, 0.568561}, {0.5,
0.529541}, {0.55, 0.491828}, {0.6, 0.455658}, {0.65, 0.42124}, {0.7,
0.38875}, {0.75, 0.358325}, {0.8, 0.330057}, {0.85, 0.30399}, {0.9,
0.280116}, {0.95, 0.25838}}
If it was a set of differential equations, I would have used ParametricNDSolveValue to create a model and FindFit evaluating the model. But I have no good idea how to efficiently code for the set of "normal" equations shown above that give, when solved with Solve, massive long solutions. FindRoot appeared "dangerous" as it often found the "wrong" branch of the solution, depending on the initialization value.
Your help would be very much appreciated how I can fit the parameters for the set of equations shown above.
If you need, please feel free to create more list data with the interactive notebook that is attached. (The data list is called “HDpoints”).
best regards,
Frank