Where the models stop

The straight line between two models

Between a constant seven-tenths of a volt and an exponential sits the model a designer actually reaches for: a drop plus a resistance. Fitted so that its worst error over a decade of current is as small as it can be, it is out by ±8.00 millivolts where the best constant is out by ±29.76 — and both numbers are the same over every decade, because a decade of a logarithm is the same shape wherever it is taken. On a real two-mechanism junction the line does best in the top decade, ±8.71 against a constant's ±58.53, because a series resistance is exactly the term the line has and the constant has none. And the resistance the fit returns is the part's plus 701 milliohms that is not there.

Assumes: The one current a constant is right at · Every model has an edge

The one current a constant is right at measures what seven-tenths of a volt is worth: it is the true forward drop at 5.748 milliamperes and at no other current, and every circuit built on it crosses zero error there. That essay closes by naming the model between a constant and an exponential — a drop plus a resistance — and claims two numbers about it without measuring either.

This is the measurement. It also settles a question the logarithm is in the collector raised in passing, which is what the resistance in that model is.

Over any decade of a pure exponential the best constant is out by ±29.76 millivolts and the best drop-plus-resistance by ±8.00 — a factor of 3.72, at every decade, to a part in a thousand. Neither number depends on which decade, because a decade of a logarithm is the same shape wherever it is taken.

Over one decade a constant is out by ±29.76 mV and a drop plus a resistance by ±8.002 mVcomputed by solving, not by drawing. The forward drop of a pure exponential junction over the decade from 1e-3 to 1e-2 amperes, with the best constant drop and the best drop-plus-resistance drawn across it. Both are fitted minimax — the model whose WORST error over the window is smallest, which is what a design has to tolerate — rather than by least squares. The constant is 684.6 mV and is out by ±29.76 mV; the line is 656.2 mV plus 6.61 Ω and is out by ±8.002 mV, which is 3.72 times better. The best constant needs no search: it is the midpoint of the window's highest and lowest voltage, and its error is half their difference.6606807007201m10mcurrent through the junction (amperes)forward drop (millivolts)a constant 684.6 mV656.2 mV + 6.61 Ωthe window1e-3 to 1e-2 Abest constant684.6 mV…worst error±29.76 mVbest line656.2 mV + 6.61 Ω…worst error±8.002 mVthe line is better by×3.720solved, then checked — minimax, not least squaresthe worst error is the one a design pays
Fig. 1 The forward drop of a pure exponential junction over the decade from a milliamp to ten, with the best constant and the best drop-plus-resistance drawn across it. The constant is 684.6 mV and out by ±29.76; the line is 656.2 mV plus 6.61 Ω and out by ±8.00. The slider is the decade fitted over.

Minimax, and why it is the right fit here

Both models are fitted to minimise the worst error over the window rather than the sum of squares, and that choice is not stylistic.

A designer using a diode model is asking how far wrong a circuit can be, and the answer is set by the worst point in the range the circuit works over, not by an average over it — which is the same statement a boundary is a model and a tolerance makes about every edge in this field. Least squares would put more weight on the crowded end of a logarithmic sweep and would report a smaller number that nothing in the design can use.

For a constant the minimax fit needs no search at all: the best constant is the midpoint of the window’s highest and lowest voltage, and its worst error is half their difference. That is the whole of the constant-drop model’s accuracy, and it says immediately that the error is proportional to the number of decades covered, because the span of a logarithm is.

For a drop plus a resistance it is a search, and the function searched is well behaved. Fix the resistance; the best constant to go with it is the midpoint of the residuals and the worst error is half their spread, and that quantity is convex in the resistance. A golden-section search finds it, and the check that the search worked is the one the figures make: the two numbers it returns for a pure exponential are the same at every decade to five figures, which no fitting accident would produce.

The same everywhere, which is the point

Sweeping the window across eight decades of current, from a nanoamp to a hundred milliamps, the two errors do not move. ±29.763 for the constant, ±7.999 for the line, ratio 3.7207, at every one.

What does move is the resistance the line fits, and it moves exactly as one over the current: 6.61 megohms over the bottom decade, 661 kilohms over the next, and 661 milliohms over the top. That is the junction’s own dynamic resistance scaled by a fixed factor — 0.2559 of thermal voltage over the window’s lowest current — and it is a property of a logarithm rather than of a device.

The consequence is worth stating plainly because it is the opposite of how the model is usually described. A piecewise-linear diode’s “resistance” is not the diode’s series resistance at all. It is a number that describes the curvature of the logarithm over the window chosen, and on an ideal junction with no series resistance whatever it is still there, still large, and still essential to the fit.

Over a logarithm, neither model has a favourite decade. computed by solving, not by drawing. The worst error of the best constant drop and of the best drop-plus-resistance, fitted minimax over each decade of current in turn, for a pure exponential. Both are flat: ±29.76 mV for the constant and ±7.999 mV for the line at every decade, to a part in a thousand, with a ratio of 3.7207. The resistance the line fits is the only thing that moves, and it moves as one over the current — 6.61 MΩ at the bottom decade and 661 mΩ at the top.
Fig. 2 The two fits’ worst errors over each decade of a pure exponential in turn. Both are flat — ±29.76 mV and ±8.00 mV throughout — and the only thing that moves is the resistance the line fits, which goes as one over the current.

How much the window costs

The advantage the line has is a property of the window being narrow, and it disappears faster than the model’s popularity suggests.

Over a quarter of a decade centred on a milliamp, the constant is out by ±7.44 millivolts and the line by ±0.53 — fourteen times better. Over one decade it is 3.72 times. Over two, 2.18. Over four, 1.54. Over six decades the constant is out by ±119 millivolts and the line by ±132 — and the ratio is 1.36, which is barely worth the second parameter.

The two errors grow differently and the reason is in the shapes. The constant’s error is exactly 29.763 millivolts a decade, because it is half the span of the curve and the span is proportional to the decades. The line’s error grows as the square of the width while the window is narrow, because a straight line’s error against a smooth curve is set by the curve’s second derivative times the square of the interval — and then it stops growing that fast once the window is wide enough that the exponential’s own shape dominates.

So the practical rule is the one a designer half-knows and rarely states: a piecewise-linear diode is a good model of a circuit that works over a narrow range of current and a poor one of a circuit that does not. A rectifier feeding a fixed load lives in a fraction of a decade and the model is worth fourteen times a constant. A logarithmic amplifier lives over six and it is worth a third.

The straight line is worth fourteen times over a quarter of a decade and 1.4 times over six. computed by solving, not by drawing. The worst error of each model against how wide a window of current it is fitted over, centred on a milliamp, for a pure exponential. The constant's error is exactly 29.763 mV a decade — it is half the span of the curve, and the span of a logarithm is proportional to the decades. The line's error grows faster than that: ±0.5330 mV over a quarter of a decade, ±8.002 mV over one, ±131.7 mV over six. So the advantage falls from 14.0 times to 1.36, and a piecewise-linear diode is a good model of a narrow range and barely better than a constant over a wide one.
Fig. 3 The worst error of each model against how wide a window of current it is fitted over, centred on a milliamp. The constant’s error is exactly 29.763 mV a decade; the line’s grows faster, so its advantage falls from 14.0 times over a quarter of a decade to 1.36 over six.

Where the error sits inside the window

A minimax fit has a signature that is worth recognising, because it says whether the fit has actually converged and because it explains where the numbers come from.

The best constant over a window touches the curve at the two ends and is worst in the middle, where it is out by half the span in one direction. There are two extreme points and the error alternates sign between them — that is the whole of the constant’s minimax condition, and it is why no search is needed.

The best straight line has three extreme points and the error alternates across all three: the line sits above the curve at the two ends and below it in the middle, or the reverse. That is the equal-ripple condition, and it is what the golden-section search is finding. A fit whose residual did not alternate three times would not be the minimax fit, whatever the search reported.

The count of extreme points is one more than the number of free parameters, in both cases, which is the general rule for a best approximation by a family of that size. It is also the reason the errors behave as they do with the window’s width: for a narrow window the curve is nearly a parabola over it, the line has to straddle a parabola, and the residual goes as the second derivative times the square of the interval. The constant has to straddle a straight line and its residual goes as the first derivative times the interval. That is the whole of the square-against-linear difference the width sweep measures, arrived at without fitting anything.

A real junction, where the line has something to do

Everything above is a pure exponential, which is a curve with nothing in it but a logarithm. A real junction has two forward mechanisms and a series resistance, which two currents with one name and the resistance a slow curve cannot see measure separately, and the model’s behaviour on it is not flat at all.

Fitted decade by decade to a junction with a recombination current, a diffusion current and 600 milliohms of series resistance, both models are worst in the middle — around a microamp, where the curve is bending from one ideality factor to the other — and the straight line’s advantage runs from 3.33 at its worst to 6.72 in the top decade.

That top-decade result is the one the earlier essay predicted and did not measure. The constant is out by ±58.53 millivolts there, twice as bad as on a pure exponential, because the series resistance adds a term the constant has nowhere to put. The line is out by ±8.71, barely worse than the ±8.00 it manages on a pure exponential, because a series resistance is exactly the term it does have.

So the model is best where the device is least like a logarithm, which is not the way a piecewise-linear model is usually justified — and it is the region the logarithm is in the collector has to leave the diode’s terminals to get away from.

On a real junction the straight line is best where the constant is worst. computed by solving, not by drawing. The worst error of the best constant drop and of the best drop-plus-resistance, fitted minimax over each decade of current in turn, for a junction with two forward mechanisms and 600 mΩ of series resistance. Both models do worst in the middle, where the curve is bending from one ideality to the other, and the straight line does best in the top decade — ±8.705 mV against the constant's ±58.53 mV, a ratio of 6.72 against 3.33 at its worst. That is the series resistance straightening the curve into the shape the line has a term for, and the constant has none.
Fig. 4 The same sweep over a junction with two forward mechanisms and 600 mΩ of series resistance. Both models are worst in the middle, where the ideality factor is changing; the line is best in the top decade — ±8.71 mV against ±58.53 — because the series resistance is a term it has.

The resistance the fit returns is not the part’s

That last observation has a consequence for anybody extracting a series resistance from a curve, and it is exact.

Sweeping the part’s series resistance from zero to four ohms and fitting over the top decade each time, the resistance the fit returns is a straight line of slope one offset by 701 milliohms. A part with no series resistance at all fits as 701 milliohms; a part with 600 milliohms fits as 1.30 ohms; a part with four ohms fits as 4.70.

The offset is the junction’s own curvature over that decade, which the model has nowhere else to put, and it is the same 701 milliohms whatever the part is. So a piecewise-linear fit is a perfectly good model and a bad extraction: it describes the decade it was taken over to within nine millivolts and it reports a resistance that is out by a fixed and substantial amount.

The fit’s own error does not move at all across that sweep — ±8.706 millivolts at every series resistance — which is the check that the model is absorbing the resistance exactly. The constant’s error goes from ±31.5 to ±211.5 millivolts over the same sweep, which is what a model with no resistance term does when the part acquires one.

This is a different failure from the one the resistance a slow curve cannot see measures, and the two stack. That essay finds a three-parameter fit reading 0.184 ohms from a self-heated curve where the part has 0.580, because heating bends the top of the curve the other way. This one finds a two-parameter fit reading 701 milliohms too much, because it has nowhere to put the curve’s curvature. Both are extractions returning the number the model has room for rather than the number the part has.

A piecewise-linear fit returns the series resistance plus 701 mΩ that is not there. computed by solving, not by drawing. The resistance returned by the best drop-plus-resistance fit over the top decade of current, against the series resistance the part actually has. It is a straight line of slope one offset by 701 mΩ — the junction's own curvature over that decade, which the model has nowhere else to put — so a fit that reads 1.3 Ω is describing a part whose resistance is 600 mΩ. The fit's worst error does not move at all across the sweep, ±8.706 mV throughout, because a series resistance is exactly the term this model has. The constant's error does move, from ±31.53 mV to ±211.5 mV, because it has no such term.
Fig. 5 The resistance a drop-plus-resistance fit returns over the top decade, against the series resistance the part actually has. Slope one, offset 701 mΩ. The fit’s own worst error does not move at all, ±8.71 mV throughout, because a series resistance is exactly the term the model has.

The three models, priced

Setting the three side by side on the same window is what the comparison has been building towards, and the ordering is not the obvious one.

Over the top decade of a real junction — ten to a hundred milliamps, which is where a power rectifier lives — the exponential is exact by construction, the drop-plus-resistance is out by ±8.71 millivolts, and the constant is out by ±58.53. Fifty milliamps from a five-volt supply needs 84.3 ohms in series, and through that resistor ±58.53 millivolts of drop error is 1.39 per cent of current and ±8.71 is 0.206 per cent.

Over a decade at a milliamp the same three are exact, ±10.17 and ±37.93 millivolts. Over six decades — a tenth of a microamp to a tenth of an amp, which is a logarithmic converter’s range — they are exact, ±228.7 and ±314.5.

The ordering never reverses, and it is worth saying so because it would be a neat story if it did. A straight line is always at least slightly better than a flat one, on both curves and at every width measured: the worst the ratio gets is 1.36 on the pure exponential and 1.375 on the real junction, both over six decades. What happens instead is that the advantage becomes too small to pay for the second parameter, and that is a judgement rather than a crossing.

Where the judgement falls is the boundary the whole essay draws, and the number to carry is 2.18: at two decades the line is worth a factor of two, at four it is worth 1.54, and past that it is worth arithmetic and not accuracy. The piecewise-linear model is not a better diode. It is a better model of a narrow window.

Over one decade a constant is out by ±58.53 mV and a drop plus a resistance by ±8.706 mV. computed by solving, not by drawing. The forward drop of a junction with two mechanisms and a series resistance over the decade from 1e-2 to 1e-1 amperes, with the best constant drop and the best drop-plus-resistance drawn across it. Both are fitted minimax — the model whose WORST error over the window is smallest, which is what a design has to tolerate — rather than by least squares. The constant is 773.7 mV and is out by ±58.53 mV; the line is 710.9 mV plus 1.3 Ω and is out by ±8.706 mV, which is 6.72 times better. The best constant needs no search: it is the midpoint of the window's highest and lowest voltage, and its error is half their difference.
Fig. 6 The top decade of the real junction, with both models drawn across it. The constant is 773.7 mV and out by ±58.53; the line is 710.9 mV plus 1.30 Ω and out by ±8.71, which is 6.72 times better — the largest advantage the line has anywhere on this device.

What this settles about the constant

Two claims made earlier about this junction are now measured and one of them needs no change.

The constant is right at one current and the model between is right over a window. The one current a constant is right at found seven-tenths of a volt exact at 5.748 milliamperes and wrong everywhere else; this one finds the best constant over a stated window and its worst error there, which is the same statement made usable. A designer choosing a constant should choose the midpoint of the window’s range, not a round number — 684.6 millivolts over a milliamp to ten, not 700 — and the cost of the round number is the difference.

And the ideality factor’s window problem has a companion. The constant that is a window finds eight one-decade fits to one curve returning ideality factors from 1.23 to 1.98 with residuals that give no warning. The same thing is true here and in the same direction: a drop-plus-resistance fit over one decade has a small residual and a resistance that describes that decade. The difference is that the ideality fit’s numbers are then used as if they were the device’s, and nobody supposes a piecewise-linear model’s resistance is the device’s — except when extracting one, which is exactly when they do.

What a circuit does with the two numbers

A drop error is not what a designer budgets against; a current error is, and the translation depends on the circuit in a way that changes which model matters.

The one current a constant is right at put it exactly: what decides whether the constant-drop model is any good is not the diode at all, it is how much of the supply the diode is taking. A diode dropping 0.78 volts in a five-volt loop leaves 4.2 volts across the resistor, so a 58.5-millivolt error in the drop is a 1.39 per cent error in the current. The same diode in a 1.5-volt loop leaves 0.72 volts across the resistor and the same 58.5 millivolts is 8.2 per cent.

That scaling applies to both models equally, so it does not change which is better — it changes whether the difference is worth having. In a five-volt loop the two models differ by 1.2 per cent of current, which is inside a resistor’s tolerance and probably not worth a parameter. In a 1.5-volt loop they differ by seven per cent, which is not.

And it inverts entirely in a circuit where the diode sets a voltage rather than passing a current. A bias string of two diodes feeding a transistor pair cares about the drop and not about the current at all, and there ±58.5 millivolts against ±8.7 is the whole answer: sixty millivolts at the base of a bipolar transistor is a factor of ten in collector current, and nine is a factor of 1.4.

Still open: three segments, the temperature, and the reverse direction

Where a second segment should go. The obvious extension is two straight lines rather than one, joined at a current chosen to minimise the worst error over the whole range. For a pure exponential that break point has a closed form — the errors of the two segments are equal at the optimum, which is one equation — and the measurement worth making is how many segments it takes to reach a stated accuracy over six decades. The answer would price the piecewise-linear model against the exponential in the only currency that matters for a solver, which is arithmetic per evaluation.

The same fits across temperature. Both models’ parameters drift, and they drift differently: the constant follows the drop’s −1.81 millivolts per kelvin that two currents with one name measures, while the line’s resistance follows the thermal voltage and is therefore proportional to absolute temperature. A model whose two parameters have different temperature coefficients is a model that needs both of them specified, and nothing in the usual presentation of a piecewise-linear diode says so.

And the reverse direction, where neither model is anything. A constant drop says a reverse-biased diode conducts nothing; a drop plus a resistance says the same. The junction conducts a generated current that doubles every 8.98 kelvin and is 3.06 × 10⁵ times the forward law’s saturation current at a volt of reverse bias. Whether a piecewise-linear model should carry a third segment for that — and what a circuit has to be doing for the answer to be yes — is a question about leakage budgets rather than about curve fitting, and it is the one place where the exponential model is not simply better.

Part 6 on diode model

One argument about Diode model, and one of 6 essays on it so far, each part numbered by how much of the idea it assumes. What sits either side of it:

The objects named here

The third axis, after the field and the idea: the things themselves, and every essay that touches each one.

Bulk resistanceDesign tradeoffDynamic resistanceIdeality factorLinearisationMeasurement conditionModel range