This example models the relationship between the current
flowing through a diode (I) as a function of the forward
voltage (V) applied to the diode.

A diode has a fixed voltage drop (c), and if the voltage is
less than that, no (or very little) current flows. Once the
voltage increases above the voltage drop, the current increases
exponentially as the voltage increases. A function that models
this is:

I = exp(b*(V-c))

where V is the voltage, I is the current, c is the voltage
drop and b is a parameter that determines how fast the
current increases; the value of b varies from one diode to another.

Here are the NLREG statements to fit this function:

Title "Voltage-Current relationship for silicon diode";
Variable V; // Voltage across diode (forward bias)
Variable I; // Current in milli-amps through diode
Parameter b;
Parameter c;
Function I = exp(b*(V-c));
Plot xLabel="Voltage across diode",yLabel="Current through diode";
Data;
[ data goes here ]

Here is a plot generated by NLREG showing the function fitted to a
set of voltage and current measurements made for a diode: