Intermodulation
An amplifier can carry output intercept specifications for a one-pass, two-tone intermodulation analysis. Connect components with nP.nodal() or nP.cascade(), then request product powers or intercepts with .out(...). For noise figure and output noise density, see Noise.
Set up the two tones
Set nP.global.twoTone before constructing the components. Each frequency in fList is the first tone, f₁; the second tone is f₂ = f₁ + spacingHz. p1dBm and p2dBm are the two available source powers and may differ. They are required for a product-power calculation. Both input phases default to 0°; set phase1Deg and phase2Deg when phase matters.
nP.global.twoTone is unset by default. When it is set, components constructed afterward include the fundamental and product frequencies needed for the sweep. Construct every component in the same circuit with matching frequency rows.
Analyze an amplifier and attenuator
nP.Amp() has no IP2, IP3, or second-harmonic intercept by default. Add the specifications you have in an options object. oip2dBm and oip3dBm describe two-tone output intercepts; harmonicOip2dBm separately describes the second-harmonic output intercept. nP does not infer one from another.
nP.global.fList = nP.global.fGen(1e9, 2e9, 11);
nP.global.twoTone = {
spacingHz: 1e6,
p1dBm: -30,
p2dBm: -25
};
var amp = nP.Amp({
gainDb: 20,
oip2dBm: 42,
oip3dBm: 30,
harmonicOip2dBm: 40
});
var attenuator = nP.Attn(3);
var ampThenAtten = nP.nodal(
[amp, 1, 2],
[attenuator, 2, 3],
['out', 1, 3]
);
var results = ampThenAtten.out(
'IM2sum21dBm', 'OIP2sum21dBm',
'IM3lower21dBm', 'OIP3lower21dBm', 'H2f121dBm'
);
// Header, then 11 rows indexed by the first-tone frequency in Hz.
nP.lineTable({inputTable: [results], title: 'Two-tone products'});Each .out() row begins with f₁ in hertz. The remaining columns have the requested result in dBm. The 11 sweep points above return 11 result rows even though the components store additional internal frequency rows for fundamentals and products.
The product options for Amp() are:
| Option | Default | Purpose |
|---|---|---|
oip2dBm | Omitted | Two-tone second-order sum and difference products. |
oip3dBm | Omitted | Two-tone third-order lower and upper products. |
harmonicOip2dBm | Omitted | Second harmonics of the individual tones. |
im2PhaseDeg, im3PhaseDeg, harmonic2PhaseDeg | 0 | Phase of each generated product family in degrees. |
An omitted intercept generates no product of that family in that amplifier. For the amplifier by itself, its product-power selector returns -Infinity dBm and its OIP selector returns Infinity dBm. Those values can be read with nP.log(), but chart and table helpers require finite numeric input. Amp() can calibrate these OIP values only for matched, unilateral S-parameters with positive real forward gain.
Select products and intercepts
| Selector for ports 2 ← 1 | Output |
|---|---|
IM2diff21dBm, IM2sum21dBm | Power at f₂ − f₁ and f₁ + f₂ |
IM3lower21dBm, IM3upper21dBm | Power at 2f₁ − f₂ and 2f₂ − f₁ |
H2f121dBm, H2f221dBm | Power at 2f₁ and 2f₂ |
OIP2diff21dBm, OIP2sum21dBm | Extrapolated two-tone second-order output intercepts |
OIP3lower21dBm, OIP3upper21dBm | Extrapolated two-tone third-order output intercepts |
OIP2f121dBm, OIP2f221dBm | Extrapolated harmonic output intercepts |
The final two digits are output port, input port. Replace 21 for another pair. For a port numbered 10 or higher use parentheses, for example IM3lower(10,1)dBm. Each sweep point is analyzed separately, including when product frequencies from different points coincide. An OIP selector raises an error when a product coincides with a fundamental or another product at that sweep point, because the separate intercept cannot then be recovered from the combined wave.
Plot and reuse the result
To chart one result, pass its .out() table directly to lineChart():
var ip3 = ampThenAtten.out('OIP3lower21dBm');
nP.lineChart({
inputTable: [ip3],
title: 'Output IP3 versus first-tone frequency',
metricPrefix: 'giga',
xAxisTitle: 'First-tone frequency (GHz)',
yAxisTitle: 'Output IP3 (dBm)'
});nP.cascade(amp, attenuator) and nested nodal() or cascade() calls retain the known internal amplifier sources. Product waves propagate with their complex phase through the S-parameter network at each product frequency. The order of components can therefore change the output product powers and intercepts.
Model limits
This is a one-pass, weak-nonlinearity calculation. It does not model compression or products generated by remixing earlier products. Linear passive parts generate no intrinsic IP2 or IP3 products; they transmit existing product waves at their own frequencies. A custom n-port must provide S-parameter rows at every required frequency; any supplied noise covariance must align with those rows.
Diode intermodulation
nP.diode1N4148() also generates one-pass IM2, IM3, and harmonic waves around its selected DC bias. The model uses the junction current and charge derivatives. These are weak-signal estimates around the bias point; the model does not include large-signal compression or a datasheet-calibrated intercept.