public double ExpectVoltageConvertedToAmplitudeRatioCorrectly(double voltage) { // Amplitude ratio increases linearly by 20 dBV with power-of-10 increases of voltage. ElectricPotential v = ElectricPotential.FromVolts(voltage); return(AmplitudeRatio.FromElectricPotential(v).DecibelVolts); }
public void ExpectVoltageConvertedToAmplitudeRatioCorrectly(double voltage, double expected) { // Amplitude ratio increases linearly by 20 dBV with power-of-10 increases of voltage. ElectricPotential v = ElectricPotential.FromVolts(voltage); double actual = AmplitudeRatio.FromElectricPotential(v).DecibelVolts; Assert.Equal(expected, actual); }
/// <summary> /// Gets an <see cref="AmplitudeRatio" /> in decibels (dB) relative to 1 volt RMS from this <see cref="ElectricPotential" />. /// </summary> /// <remarks> /// Provides a nicer syntax for converting a voltage to an amplitude ratio (relative to 1 volt RMS). /// <example> /// <c>var voltageRatio = voltage.ToAmplitudeRatio();</c> /// </example> /// </remarks> public AmplitudeRatio ToAmplitudeRatio() { return(AmplitudeRatio.FromElectricPotential(this)); }
/// <summary> /// Gets an <see cref="AmplitudeRatio" /> in decibels (dB) relative to 1 volt RMS from an /// <see cref="ElectricPotential" />. /// </summary> /// <remarks> /// Provides a nicer syntax for converting a voltage to an amplitude ratio (relative to 1 volt RMS). /// <example> /// <c>var voltageRatio = voltage.ToAmplitudeRatio();</c> /// </example> /// </remarks> public static AmplitudeRatio ToAmplitudeRatio(this ElectricPotential voltage) { return(AmplitudeRatio.FromElectricPotential(voltage)); }