Documentation |
Simulate voltage source with DC, AC, and noise components
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_{DC} is the steady-state DC voltage component.
v_{AC} is the amplitude of the AC voltage component.
f is the frequency of the AC component.
ϕ is the phase offset of the AC component.
v_{N} is the noise voltage.
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_{v} is the single-sided noise power spectral density for a 1 ohm load, in V^2/Hz.
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 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.
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.
The DC component of the output voltage. The default value is 0 V. Enter a nonzero value to add a DC component to the voltage source.
Amplitude of the AC component of the output voltage. The default value is 0 V. Enter a nonzero value to add an AC component to the voltage source.
Phase offset of the AC component of the output voltage. The default value is 0 degrees.
Frequency of the AC component of the output voltage. The default value is 60 Hz.
Select the noise option:
Disabled — No noise is produced by the voltage source. This is the default.
Enabled — The voltage source generates thermal noise, and the associated parameters become visible on the Noise tab.
The single-sided spectrum noise power. Strictly-speaking, this is a density function for the square of the voltage, commonly thought of as a power into a 1 ohm load, and therefore the units are V^2/Hz. To avoid this unit ambiguity, some datasheets quote noise voltage as a noise density with units of V/√Hz. In this case, you should enter the square of the noise density quoted in the datasheet as the parameter value. The default value is 0 V^2/Hz.
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.
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.
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.