# Convert an error function to a least squares fitting?

Posted 2 months ago
118 Views
|
0 Replies
|
0 Total Likes
|
 I have written an error function to compare simulated values to experimental data, but I also want to have a least squares fitting. I know that Mathematica has a function for it, I'm just not sure how that function can compare to what I want. The error function that I have take a difference between simulation and data, then normalizes the difference to the average of the simulation and data at that condition to give a numerical description. Could someone help me in writing a least squares version of this? Example equation pasted below. errr = 1/ 8 ((2 Abs[rcias - rciax])/(rcias + rciax) + ( 2 Abs[risus - risux])/(risus + risux) + (2 Abs[rvps - rvpx])/( rvps + rvpx) + (2 Abs[rmps - rmpx])/(rmps + rmpx) + ( 2 Abs[rc - rcx])/(rc + rcx) + (2 Abs[rfm - rfmx])/( rfm + rfmx) + (2 Abs[rf3 - rf3x])/(rf3 + rf3x) + ( 2 Abs[rf2 - rf2x])/(rf2 + rf2x));