lcapy.noiseexpr.NoiseExpression

class lcapy.noiseexpr.NoiseExpression(val, **assumptions)

Bases: Expr

Frequency domain (one-sided) noise spectrum expression (amplitude spectral density).

This characterises a zero-mean Gaussian noise process.

When performing arithmetic on two noiseExpr expressions it is assumed that they are uncorrelated unless they have the same nid (noise indentifier). If the nid is not specified, a new one is created.

Uncorrelated noise expressions are added in quadrature (on a power basis). Thus (NoiseExpression(3) + NoiseExpression(4)).expr = 5 since 5 = sqrt(3**2 + 4**2)

NoiseExpression(3) != NoiseExpression(3) since they are different noise realisations albeit with the same properties. However, NoiseExpression(3).expr == NoiseExpression(3).expr. Similarly, NoiseExpression(3, nid=’n1’) == NoiseExpression(3, nid=’n1’) since they have the same noise identifier and thus have the same realisation.

Caution: The sum of two noise expressions generates a noise expression with a new nid. This can lead to unexpected results since noise expressions with different nids are assumed to be uncorrelated. For example, consider: a = NoiseExpression(3); b = NoiseExpression(4) a + b - b gives sqrt(41) and a + b - a gives sqrt(34).

This case is correctly handled by the Super class since each noise component is stored and considered separately.

(Voltage(a) + Voltage(b) - Voltage(b)).n gives 3 as expected.

Methods

__init__(val, **assumptions)

There are three types of assumptions:

asd()

autocorrelation()

fourier()

laplace()

plot([fvector])

Plot frequency response at values specified by fvector.

psd()

rms()

Calculate rms value.

sample(t[, seed])

Return a sample function (realisation) of the noise process evaluated at time values specified by vector t.

subs(*args, **kwargs)

Substitute values into the noise expression.

time()

Attributes

is_positive

is_real

nid

plot(fvector=None, **kwargs)

Plot frequency response at values specified by fvector.

There are many plotting options, see matplotlib.pyplot.plot.

For example:

V.plot(fvector, log_frequency=True) V.real.plot(fvector, color=’black’) V.phase.plot(fvector, color=’black’, linestyle=’–‘)

By default complex data is plotted as separate plots of magnitude (dB) and phase.

rms()

Calculate rms value.

sample(t, seed=None)

Return a sample function (realisation) of the noise process evaluated at time values specified by vector t. If t is an integer, this returns t samples.

subs(*args, **kwargs)

Substitute values into the noise expression.