Resistor

Model linear resistor with optional noise

Passive Devices

Description

The Resistor block models a linear resistor, described with the following equation:

$i=v/R$

where:

• i is the current.

• v is the voltage.

• R is the resistance.

Optionally, the Resistor block can generate thermal noise current. If you set the Noise mode parameter to `Enabled`, then the defining equations are augmented by a discrete variable iN to represent thermal noise:

$i=v/R+{i}_{N}$

If the sampling time is h, then the thermal noise is given by:

${i}_{N}=\sqrt{2kT/R}\frac{N\left(0,1\right)}{\sqrt{h}}$

where:

• k is the Boltzmann constant, 1.3806504e-23 J/K.

• T is the temperature.

• R is the resistance.

• N is a Gaussian random number with zero mean and standard deviation of one.

• 2kT/R is the double-sided thermal noise power distribution (the single-sided equivalent is 4kT/R).

If you set the Noise mode parameter to `Disabled`, then no noise is added, and the component behavior is identical to the Simscape™ Foundation library Resistor block.

Noise Options

The block generates Gaussian noise by using the Random Number source in the Simscape Foundation library. You can control the random number seed by setting the Repeatability parameter:

• `Not repeatable` — Every time you simulate your model, the block resets the random seed using the MATLAB® random number generator:

`seed = randi(2^32-1);`
• `Repeatable` — The block uses a hidden parameter, called `auto_seed`, to always start the simulation with the same random number. The value of `auto_seed` is set whenever you copy the Resistor block from the block library to the model, or when you make a new copy of the Resistor block from an existing one in a model. The block sets the value using the MATLAB random number generator command shown above.

• `Specify seed` — If you select this option, the additional Seed parameter lets you directly specify the random number seed value.

Basic Assumptions and Limitations

Simulating with noise enabled slows down simulation. Choose the sample time (h) so that noise is generated only at frequencies of interest, and not higher.

Dialog Box and Parameters

Main Tab

Resistance

The resistance value. The default value is `1` Ω.

Noise Tab

Noise mode

Select the noise option:

• `Disabled` — No noise is produced by the resistor. This is the default.

• `Enabled` — Resistor generates thermal noise current, and the associated parameters become visible on the Noise tab.

Device simulation temperature

The temperature of the thermal resistor at the start of the simulation. The default value is `25` °C.

Sample time

Defines the rate at which the noise source is sampled. Choose it to reflect the frequencies of interest in your model. Making the sample time too small will unnecessarily slow down your simulation. The default value is `1e-3` s.

Repeatability

Select the noise control option:

• `Not repeatable` — The random sequence used for noise generation is not repeatable. This is the default.

• `Repeatable` — The random sequence used for noise generation is repeatable, with a system-generated seed.

• `Specify seed` — The random sequence used for noise generation is repeatable, and you control the seed by using the Seed parameter.

Seed

Random number seed used by the noise random number generator. This parameter is visible only if you select ```Specify seed``` for the Repeatability parameter. The default value is `0`.

Ports

The block has the following ports:

`+`

Positive electrical port

`-`

Negative electrical port