Did you know that Micro-Cap 11 has a built-in curve fitting function? Any plotted curve can be fitted
to an N-degree polynomial. Consider this circuit:
This circuit has a single voltage source whose output is:
B*X+A+RF*RND/2
where A, B, and RF are 3 , 6, and 1 respectively and X is set to the T (Time) variable. RND is a random
number between 0 and 1. The E1 source then generates a line whose equation is
6*T+3 + RND/2.
If you run transient analysis on it you get this plot.
Here the line is drawn with its random element. The curve has been fitted to a linear equation per
the instruction from the Curve Fit dialog box. It looks like this:
This dialog box lets you select the curve(s) to be fitted, the range over which the fit will occur, and
the polynomial degree for the fit. You can also choose options for placing the equation and error
text as well as options for numeric format, and text style.
The dialog box is selected from the Scope menu / Curve Fit or by using CTRL+ALT+C, or by
right-clicking on any expression text in the analysis plot.
This example is a simple one. Next we'll try a more complex curve to fit.
Consider this circuit:
There are no sources, just .define statements specifying a quadratic (Y2) and a 6'th order polynomial
(Y). Run transient analysis and you get this plot:
The routine has fitted the quadratic curve as Y = -4 +-2*X + -3*X^2 and the 6'th order curve as
Y = -1 -2*X -3*X^2 +200m*X^3 +1*X^4 +100m*X^5 +50m*X^6. Both fits have RMS errors of
less than 1e-12.
|