public double ExpectAmplitudeRatioConvertedToVoltageCorrectly(double amplitudeRatio) { // Voltage increases by powers of 10 for every 20 dBV increase in amplitude ratio. AmplitudeRatio ar = AmplitudeRatio.FromDecibelVolts(amplitudeRatio); return(AmplitudeRatio.ToElectricPotential(ar).Volts); }
public void ExpectAmplitudeRatioConvertedToVoltageCorrectly(double amplitudeRatio, double expected) { // Voltage increases by powers of 10 for every 20 dBV increase in amplitude ratio. AmplitudeRatio ar = AmplitudeRatio.FromDecibelVolts(amplitudeRatio); double actual = ar.ToElectricPotential().Volts; Assert.Equal(expected, actual); }
/// <summary> /// Gets an <see cref="ElectricPotential" /> from <see cref="AmplitudeRatio" />. /// </summary> /// <paramref name="amplitudeRatio">The amplitude ratio to convert.</paramref> /// <remarks> /// Provides a nicer syntax for converting an amplitude ratio back to a voltage. /// <example> /// <c>var voltage = voltageRatio.ToElectricPotential();</c> /// </example> /// </remarks> public static ElectricPotential ToElectricPotential(this AmplitudeRatio amplitudeRatio) { return(AmplitudeRatio.ToElectricPotential(amplitudeRatio)); }