How to fit IMPLICIT functions with Matlab! A worked-out example
In Matlab you can perform implicit curve fit using either "nlinfit" or "lsqcurvefit" (the last one only if you have the optimization toolbox) but you need to re-write the implicit function into an explicit one solving it numerically (i.e. using "fzero"). THERE IS NO WAY to fit directly using an implicit expression! To learn how to successfully fit using an implicit function you can follow the instructions on this Matlab page page or to read and use my worked-out example. I will show you how my implementation of the Langevin function with a field Weiss (that is an implicit equation). This example is interesting by itself becasue it addresses the topic of how to model an hysteresis loop. The equation is taken from the paper by D.C. Jiles and D.L. Atherton , Ferromagnetic Hysteresis , IEEE Transaction on Magnetics, Vol. Mag-19, No. 5, September 1983. For a general reference about the Langevin equation (and generally for magnetism) I recommend the ...