After some more investigation currently I feel that I should move toward an other direction.
Some reasons:
The new commit:
Even with this changes I cannot simulate MCP6561 with LTSpice...
The new commit supports variable table length. At least 2 points must be present within the table. The table "curve" must have only one inflection point.
Now the --show option shows the table "curve" even if the tanh() fitting was not successful.
.tgzs were updated.
[endre@dudu LTSpice]$ ./softtable.sh --show 'TABLE {V(35,3)} ((-1,-1n)(0,0)(2.00,1n))(2.2,1))'
[ERR 2013.03.02 14:59:07.062 softtable.Main.main(182)] Tables with this slope distribution ([1.0E-9, 5.0E-10, 4.999999]) are not handled!
[endre@dudu LTSpice]$
Now it is possible to change all the identified TABLE statements within a spice model or library file:
[endre@dudu LTSpice]$ ./softtable.sh -i models/MCP6561.orig.txt > models/MCP6561.txt
In the 'a * tanh(g * (x - x0)) + y0' output, the x0 was printed with wrong sign, this is corrected.
Now the printed function contains some trivial simplifications. E.g. "-3.0 * tanh(1.0*(x - 0.0)) + 0.0" is printed as "-3.0 * tanh(x)".
A "--spice" option has been added to output a usable spice line:
$ ./softtable.sh --spice "G36 33 0 TABLE {V(35,4)} ((-2.2,-1)((-1.8,-1)(-1.5,0.99)(-1,1))"
G36 33 0 value=(tanh(6.6335*(V(35,4) + 1.6492462)))
$