Main Content

Voltage source with optional DC, AC and noise components

**Library:**Simscape / Electrical / Sources

The Voltage Source block implements a voltage source with
DC, AC, and noise components. The voltage across the **+** and
**–** terminals is given by:

$$v={v}_{DC}+{v}_{AC}\mathrm{sin}\left(2\pi ft+\varphi \right)+{v}_{N}$$

where:

*v*is the steady-state DC voltage component._{DC}*v*is the amplitude of the AC voltage component._{AC}*f*is the frequency of the AC component.*ϕ*is the phase offset of the AC component.*v*is the noise voltage._{N}

You can configure your source as DC-only, AC-only, or a combination of both. By default, both AC and DC components are set to 0. Define the AC/DC voltage by specifying nonzero parameter values after placing the block in your model.

The noise component is also optional. If you set the **Noise mode**
parameter to `Enabled`

, then the added noise voltage is given
by:

$${v}_{N}=\sqrt{{P}_{v}/2}\frac{N\left(0,1\right)}{\sqrt{h}}$$

where:

*P*is the single-sided noise power spectral density for a 1 ohm load, in V^2/Hz._{v}*N*is a Gaussian random number with zero mean and standard deviation of one.*h*is the sampling interval.

By default, the **Noise mode** parameter is set to
`Disabled`

, and the voltage source generates no thermal
noise.

The block generates Gaussian noise by using the PS
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 automatically generates a seed value and stores it inside the block, to always start the simulation with the same random number. This auto-generated seed value is set when you add a Voltage Source block from the block library to the model. When you make a new copy of the Voltage Source block from an existing one in a model, a new seed value is generated. 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.

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.