Fitting vacuum tube parameters with Igor Pro

All the informations you find here are only for educational use! I am not responsible for everything including disasters/deaths coming from the usage af the data/info given here. You use all these informations of your own risk. The equations I used are taken from Duncan's amp page, M. F. Konar and F. Pintavalle. If you think, that these informations are stolen or insure a copyright then e-mail me.


On Duncan's homepage you can download Spice-models for the most popular vacuum tubes with links to other sites where the mathematical methods of getting the Spice-parameters are explained. I saw, that for computer based models Matlab is used, wich is, in my opinion, too complicate to use for beginners [like me :-)]. At work I'm using Igor Pro from Wavemetrics and I think that this tool is much easier to use than Matlab. You can download a free trial version from wavemetrics wich you can use like the full version, only saving, printing and other features are not allowed. I decided to show here how you can use the fitting function from Igor Pro instead of using Matlab with his m-files. The great advantage is that Igor Pro is mouse-supported including windows and command lines. So it will takes you only one or two hours to learn using Igor Pro.

First step

Download the Igor Pro trial version and install Igor Pro on your computer. Remember that Igor Pro will not run under Windows 3.xx. See the systems requirements at wavemetrics homepage. Start Igor Pro and try the guided tour trough Igor Pro if you have time. You will see a title bar with FILE EDIT DATA ... MISC HELP. Here you find all the basic commands. All actions you are making are written to the command line (wich is called history in Igor Pro's language) you will find at bottom. This feature allows you to type commands direct into the command line or copy commands from the history into the command line. After writing a command into the command line just press ENTER and the command will be executed.

EXAMPLE: Click on the history and type "print 8/4" (without the "") in the command line and press ENTER. In the history you will see •print 8/4 2. So you see the command and the result. Easy, isn't it?

Igor Pro works with waves. As example if you want to plot a mathematical function like sinus or cosinus you cannot type y=sin(x) in the command line. You have first to define x and y as waves and then you can calculate with them. This I will explain now.

Define datapoints and waves and plot a graph with Igor Pro

1. Click on title bar at WINDOWS and select NEW TABLE. You will get a new window.
2. Just click DO IT. A empty table is here.
3. In the first column (wich has a frame) type 1 and press ENTER.
    The first point is entered and the first wave is automatically named (here:WAVE 0).
4. Continue enter points as explained: 2 ENTER 3 ENTER 4 ENTER 5 ENTER 6 ENTER. Don't change the column!
    You have now a column (called wave0) with six datapoints.
5. Click in the next column (just right from wave 0).
6. Press 2 on the keyboard an then ENTER. This is the first point of WAVE 1.
7. Continue enter points as explained: 4 ENTER 6 ENTER 8 ENTER 10 ENTER 12 ENTER. Don't change the column!
    You have now another column (called wave1) with six datapoints.
8. Move the mouse cursor above the name (WAVE0) in the table (top of table) and push right mouse button. A menu comes.
9. Select RENAME... and push left mouse button. You get a new window.
10. Now wave0 is market. In the RENAME AS box type the new name in: TESTX.
11. With the mouse mark wave1 and rename wave1 as TestY.
12. Click DO IT. Now you have changed the wavenames.
13. Click at title bar on WINDOWS and select NEW GRAPH. You will get a new window.
14. As YWave(s) select Testy and as XWave select Testx. Then click on DO IT.
      You have now a graph!

Approximation for the 12AX7(ECC83) using "3/2 power law"

I took the points for the ECC83 from the datasheet of Telefunken (ECC_83_1.pdf) wich you can download in the datasheet section:

-1.5270 0.0026

Enter the points into a new table in Igor Pro (as explained above and rename the waves to Up, Ug, Id. Don't choose other names!
You should have this picture:


Create a new graph with Id as YWave(s) and Up as XWave. You should have this picture:


Click on title bar at WINDOWS and choose PROCEDURE WINDOW. A new window opens. Download, unzip the file and open the macro.txt with an text editor. Copy the whole text into the procedure window from Igor Pro. You should have now this picture:


In the Procedure Window click on COMPILE and close the window. Click on title bar at MACROS. There you will find two names: FIT_KOREN and FIT_POWER_LAW. Click first on FIT_POWER_LAW. The computer calculates and stop then. In the history (above the command line) you will see an output:

Fit converged properly
y= power_law(PCoeffs, Up, Ug)
PCoeffs={0.00050811,61.001}  *this are the the fitted parameters*
V_chisq= 2.40026e-08; V_npnts= 8; V_numNaNs= 0; V_numINFs= 0;

We have now Id approximated as a function of Up and Ug using the "3/2 power law". The equation is:


where pw[0] and pw[1] are the fitted parameters in PCoeffs wich you find in the history of Igor Pro. The other parameters are explained in the help tool from Igor Pro.
Click on your graph wich you created (Id vs Up) and click on title bar at GRAPH and choose APPEND TRACES TO GRAPH. Take IdFit as YWave(s) and Up as XWave and click DO IT. Click on title bar at GRAPH and choose MODIFY TRACE APPEREANCE. A new window opens. Click at IdFit, change the color to blue and click DO IT. You should have this picture:


The red line are the points from the datasheet and the blue line is the approximated curve. You can change the red line into single points by using GRAPH and choosing MODIFY TRACE APPEREANCE. There click on MODE and choose MARKERS and click on DO IT.

Approximation for the 12AX7(ECC83) using "Koren's law"

Koren's law uses the following eguation:


You see that here are more parameters used than in the "3/2 power law". We will now use this equation with Igor Pro:
First type the following text into the command line of Igor Pro:

Make/O WCoeffs={225,590,0.001,11000,1.2}

We have now made a guess for the initial parameters for the curve fitting. You can change these parameters, but when you make a bad guess the fit is not good or you recieve an error.
Click on title bar at MACROS. Click on FIT_KOREN. Now the computer calculates the new Fit. In the history (above the command line) you will see an output:

Fit converged properly
y= Koren(WCoeffs, Up, Ug)
WCoeffs={45.266,424.73,0.0031342,11422,0.96653}  *this are the the fitted parameters*
V_chisq= 6.48976e-09; V_npnts= 8; V_numNaNs= 0; V_numINFs= 0;

You should now see this picture:


Note that the datapoints from the ECC83 are now printed as markers and the Fit is the blue line. If you don't see the graph like above, then you have to add IdFit again: In the same way as explained above click on the graph (Id vs Up) and add IdFit vs Up to the graph and change the color from IdFit from red to blue.


I hope that you like this small education in curve fitting with Igor Pro. I found other functions for curve fitting on the net, but I'm shure that you are able to implement this functions by yourself into Igor Pro.
The biggest problem is to find good startvalues for the fit and using the right datapoints.
I have not tried to put these equations into PSpice, so please don't ask me about. I don't know too if Igor Pro brings better parameters than Matlab.
So here you can download more datapoints from the ECC83. Just unzip, open the data.txt and copy the values into a new table in Igor Pro, look that you have the right wavenames and fit them. Pearhaps you have first to delete the old waves with the same name. You can delete this waves by choosing DATA from the title bar and click on KILL WAVES. If you have suggestions or problems using this informations than e-mail me. Pearhaps I'm able to help you.