Convert decibels to amplitude - Built-in function
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
Is there a built-in function to convert decibels to amplitude in Mathematica? I tried with:
UnitConvert[Quantity[40, "decibels"], "amplitude"]
but it does not work.
Online I found only a widget for Wolfram Alpha:
http://www.wolframalpha.com/widgets/view.jsp?id=21e1ea77bd91aaa0fc4d01a943a654e
units education
 |Â
show 4 more comments
up vote
2
down vote
favorite
Is there a built-in function to convert decibels to amplitude in Mathematica? I tried with:
UnitConvert[Quantity[40, "decibels"], "amplitude"]
but it does not work.
Online I found only a widget for Wolfram Alpha:
http://www.wolframalpha.com/widgets/view.jsp?id=21e1ea77bd91aaa0fc4d01a943a654e
units education
10^(amplitudeIndB/20.)
â andre
Aug 8 at 16:14
Hello @andre, I am looking for a built-in function that does the same thing.
â Gennaro Arguzzi
Aug 8 at 16:17
1
Why insist on built-in? I think answer will be no such built-in, although the external resources (databases, W|A) continue to evolve, I think. W|A does not seem currently to be able to recognize "amplitude ratio" or the ISO term "root-power quantity," which does not seem to be an ISO unit per se or have a unit name/symbol.
â Michael E2
Aug 8 at 17:27
1
@MichaelE2 The confusing part is, the document ofQuantity
claims that "Supported units include all those specified by NIST Special Publication 811. " And decibel is indeed mentioned thereâ¦
â xzczd
Aug 8 at 17:48
1
@xzczd Yes, I knew. I thought you would point out thatUnitConvert
cannot convert decibels to bels, though. It says they are incompatible (Quantity::compat
), which seems an error to me. It seems anIndependentUnit
is treated as having "no relationship to other units within a Quantity."
â Michael E2
Aug 8 at 18:38
 |Â
show 4 more comments
up vote
2
down vote
favorite
up vote
2
down vote
favorite
Is there a built-in function to convert decibels to amplitude in Mathematica? I tried with:
UnitConvert[Quantity[40, "decibels"], "amplitude"]
but it does not work.
Online I found only a widget for Wolfram Alpha:
http://www.wolframalpha.com/widgets/view.jsp?id=21e1ea77bd91aaa0fc4d01a943a654e
units education
Is there a built-in function to convert decibels to amplitude in Mathematica? I tried with:
UnitConvert[Quantity[40, "decibels"], "amplitude"]
but it does not work.
Online I found only a widget for Wolfram Alpha:
http://www.wolframalpha.com/widgets/view.jsp?id=21e1ea77bd91aaa0fc4d01a943a654e
units education
edited Aug 8 at 16:26
asked Aug 8 at 16:10
Gennaro Arguzzi
269210
269210
10^(amplitudeIndB/20.)
â andre
Aug 8 at 16:14
Hello @andre, I am looking for a built-in function that does the same thing.
â Gennaro Arguzzi
Aug 8 at 16:17
1
Why insist on built-in? I think answer will be no such built-in, although the external resources (databases, W|A) continue to evolve, I think. W|A does not seem currently to be able to recognize "amplitude ratio" or the ISO term "root-power quantity," which does not seem to be an ISO unit per se or have a unit name/symbol.
â Michael E2
Aug 8 at 17:27
1
@MichaelE2 The confusing part is, the document ofQuantity
claims that "Supported units include all those specified by NIST Special Publication 811. " And decibel is indeed mentioned thereâ¦
â xzczd
Aug 8 at 17:48
1
@xzczd Yes, I knew. I thought you would point out thatUnitConvert
cannot convert decibels to bels, though. It says they are incompatible (Quantity::compat
), which seems an error to me. It seems anIndependentUnit
is treated as having "no relationship to other units within a Quantity."
â Michael E2
Aug 8 at 18:38
 |Â
show 4 more comments
10^(amplitudeIndB/20.)
â andre
Aug 8 at 16:14
Hello @andre, I am looking for a built-in function that does the same thing.
â Gennaro Arguzzi
Aug 8 at 16:17
1
Why insist on built-in? I think answer will be no such built-in, although the external resources (databases, W|A) continue to evolve, I think. W|A does not seem currently to be able to recognize "amplitude ratio" or the ISO term "root-power quantity," which does not seem to be an ISO unit per se or have a unit name/symbol.
â Michael E2
Aug 8 at 17:27
1
@MichaelE2 The confusing part is, the document ofQuantity
claims that "Supported units include all those specified by NIST Special Publication 811. " And decibel is indeed mentioned thereâ¦
â xzczd
Aug 8 at 17:48
1
@xzczd Yes, I knew. I thought you would point out thatUnitConvert
cannot convert decibels to bels, though. It says they are incompatible (Quantity::compat
), which seems an error to me. It seems anIndependentUnit
is treated as having "no relationship to other units within a Quantity."
â Michael E2
Aug 8 at 18:38
10^(amplitudeIndB/20.)
â andre
Aug 8 at 16:14
10^(amplitudeIndB/20.)
â andre
Aug 8 at 16:14
Hello @andre, I am looking for a built-in function that does the same thing.
â Gennaro Arguzzi
Aug 8 at 16:17
Hello @andre, I am looking for a built-in function that does the same thing.
â Gennaro Arguzzi
Aug 8 at 16:17
1
1
Why insist on built-in? I think answer will be no such built-in, although the external resources (databases, W|A) continue to evolve, I think. W|A does not seem currently to be able to recognize "amplitude ratio" or the ISO term "root-power quantity," which does not seem to be an ISO unit per se or have a unit name/symbol.
â Michael E2
Aug 8 at 17:27
Why insist on built-in? I think answer will be no such built-in, although the external resources (databases, W|A) continue to evolve, I think. W|A does not seem currently to be able to recognize "amplitude ratio" or the ISO term "root-power quantity," which does not seem to be an ISO unit per se or have a unit name/symbol.
â Michael E2
Aug 8 at 17:27
1
1
@MichaelE2 The confusing part is, the document of
Quantity
claims that "Supported units include all those specified by NIST Special Publication 811. " And decibel is indeed mentioned thereâ¦â xzczd
Aug 8 at 17:48
@MichaelE2 The confusing part is, the document of
Quantity
claims that "Supported units include all those specified by NIST Special Publication 811. " And decibel is indeed mentioned thereâ¦â xzczd
Aug 8 at 17:48
1
1
@xzczd Yes, I knew. I thought you would point out that
UnitConvert
cannot convert decibels to bels, though. It says they are incompatible (Quantity::compat
), which seems an error to me. It seems an IndependentUnit
is treated as having "no relationship to other units within a Quantity."â Michael E2
Aug 8 at 18:38
@xzczd Yes, I knew. I thought you would point out that
UnitConvert
cannot convert decibels to bels, though. It says they are incompatible (Quantity::compat
), which seems an error to me. It seems an IndependentUnit
is treated as having "no relationship to other units within a Quantity."â Michael E2
Aug 8 at 18:38
 |Â
show 4 more comments
1 Answer
1
active
oldest
votes
up vote
6
down vote
accepted
There is nothing in the documentation, and bellow you can see what you can find in the internal functions, of which nothing that seems to do the job. So the answer to your question is:
No, there is no built-in function to convert decibels to amplitude in Mathematica.
Speculation on "why"
We can only guess why the developers didn't implement this, a possible narrative may be similar to the case of the now deprecated Units
Package. There the documentation said:
"The conversion of temperature units is different from most other unit
conversions because it is not multiplicative. This is simply because
the zeros of various systems are set at different values. For example,
zero degrees Centigrade is the same as 32 degrees Fahrenheit."
So you had to use ConvertTemperature
instead of Convert
. How is that similar? It's similar because both cases are somehow special. Wikipedia says
The decibel (symbol: dB) is a unit of measurement used to express the
ratio of one value of a physical property to another on a logarithmic
scale.
dB is NOT an amount of a physical quantity, but a the logarithm of a ratio of two quantities in the same units, therefore unitless and non-linear. Also depending if the you are talking about amplitudes or power (amplitude squared) the factors are 20 or 10.
Therefore, non-linear relationship of something that arguably may not be even a unit with a potentially ambiguous definition... better leave it to the users to define their own, rather simple, solutions.
A solution
dB2lin[x_] := N[Power[10, x/20]];
lin2dB[x_] := N[20 Log10[x]];
Internal functions
Some functions with matching names
Names["*`*Decibel*", IgnoreCase -> True]
(* "Signal`Utils`decibelQ", "Signal`Utils`decibelQ$",
"CalculateUnits`UnitCommonSymbols`DecibelsMuUnit",
"CalculateUnits`UnitCommonSymbols`CalculateUnits`UnitCommonSymbols`
DecibelsMuUnit", "CalculateUnits`UnitCommonSymbols`DecibelsRUnit",
"CalculateUnits`UnitCommonSymbols`DecibelsVUnit",
"CalculateUnits`UnitCommonSymbols`DecibelsZUnit" *)
Names["*`db*"]
(* "Image`ColorOperationsDump`db",
"Image`ColorOperationsDump`Image`ColorOperationsDump`db",
"Predictions`Private`db",
"Predictions`Private`Predictions`Private`db",
"Statistics`Library`Dump`dbag", "Statistics`Library`Dump`dbag$",
"PacletManager`LayoutDocsCollection`Private`dbFile",
"System`FourierTransformDump`dbgPrintFT",
"Charting`ChartLabelingDump`dbgstyle",
"Charting`ChartLabelingDump`dbgstyle$",
"Charting`ChartLabelingDump`dbox", "Charting`dbPrint",
"Image`ColorOperationsDump`dbPrint", "Image`HumanDump`dbPrint",
"Image`SpatialOperationsDump`dbPrint",
"Visualization`VectorFields`VectorFieldsDump`dbPrint",
"Wavelets`WaveletUtilities`dbPrint",
"PacletManager`LayoutDocsCollection`Private`dbStrm",
"PacletManager`LayoutDocsCollection`Private`dbStrm$",
"Charting`CommonDump`dbstyle",
"Charting`ChartLabelingDump`dbTimingReap",
"Charting`ChartLabelingDump`dbVpp", "Charting`ParserDump`dbVpp",
"System`ListPointPlot3DDump`dbVpp",
"System`ListPointPlot3DDump`System`ListPointPlot3DDump`dbVpp" *)
Hello @rhermans, thank you for your extremely clear answer.
â Gennaro Arguzzi
Aug 8 at 17:06
"It's not an amount of a physical quantity, but a the logarithm of a ratio of two quantities in the same units, therefore unitless. " Hmm⦠butUnitConvert[Quantity[40, "AngularDegrees"], "Radians"]
works.
â xzczd
Aug 8 at 17:12
@xzczd remember that with theUnits
package "The conversion of temperature units is different from most other unit conversions because it is not multiplicative. This is simply because the zeros of various systems are set at different values. For example, zero degrees Centigrade is the same as 32 degrees Fahrenheit." so you had to useConvertTemperature
instead ofConvert
. Is not that there are no ways around, but these are special cases. And radians is closer to the idea of a units, as they are amounts of $pi$
â rhermans
Aug 8 at 17:17
Well,"AngularDegrees"
isn't a unit for temperature, it's a unit for angle, which is dimensionless. With this example I just want to illustrate that dimensionless or unitless doesn't seem to be a reason for the "failure" of Mathematica.
â xzczd
Aug 8 at 17:25
1
UnitConvert
will callInternal`MWACompute["MWAToQuantity", name]
to use WolframAlpha to assist with units when the unitname
is not among the built-in ones. Now W|A can convert between decibels and bels, butUnitConvert
cannot. So the call to W|A might only result in anIndependentUnit
that cannot be converted.
â Michael E2
Aug 8 at 18:36
 |Â
show 2 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
There is nothing in the documentation, and bellow you can see what you can find in the internal functions, of which nothing that seems to do the job. So the answer to your question is:
No, there is no built-in function to convert decibels to amplitude in Mathematica.
Speculation on "why"
We can only guess why the developers didn't implement this, a possible narrative may be similar to the case of the now deprecated Units
Package. There the documentation said:
"The conversion of temperature units is different from most other unit
conversions because it is not multiplicative. This is simply because
the zeros of various systems are set at different values. For example,
zero degrees Centigrade is the same as 32 degrees Fahrenheit."
So you had to use ConvertTemperature
instead of Convert
. How is that similar? It's similar because both cases are somehow special. Wikipedia says
The decibel (symbol: dB) is a unit of measurement used to express the
ratio of one value of a physical property to another on a logarithmic
scale.
dB is NOT an amount of a physical quantity, but a the logarithm of a ratio of two quantities in the same units, therefore unitless and non-linear. Also depending if the you are talking about amplitudes or power (amplitude squared) the factors are 20 or 10.
Therefore, non-linear relationship of something that arguably may not be even a unit with a potentially ambiguous definition... better leave it to the users to define their own, rather simple, solutions.
A solution
dB2lin[x_] := N[Power[10, x/20]];
lin2dB[x_] := N[20 Log10[x]];
Internal functions
Some functions with matching names
Names["*`*Decibel*", IgnoreCase -> True]
(* "Signal`Utils`decibelQ", "Signal`Utils`decibelQ$",
"CalculateUnits`UnitCommonSymbols`DecibelsMuUnit",
"CalculateUnits`UnitCommonSymbols`CalculateUnits`UnitCommonSymbols`
DecibelsMuUnit", "CalculateUnits`UnitCommonSymbols`DecibelsRUnit",
"CalculateUnits`UnitCommonSymbols`DecibelsVUnit",
"CalculateUnits`UnitCommonSymbols`DecibelsZUnit" *)
Names["*`db*"]
(* "Image`ColorOperationsDump`db",
"Image`ColorOperationsDump`Image`ColorOperationsDump`db",
"Predictions`Private`db",
"Predictions`Private`Predictions`Private`db",
"Statistics`Library`Dump`dbag", "Statistics`Library`Dump`dbag$",
"PacletManager`LayoutDocsCollection`Private`dbFile",
"System`FourierTransformDump`dbgPrintFT",
"Charting`ChartLabelingDump`dbgstyle",
"Charting`ChartLabelingDump`dbgstyle$",
"Charting`ChartLabelingDump`dbox", "Charting`dbPrint",
"Image`ColorOperationsDump`dbPrint", "Image`HumanDump`dbPrint",
"Image`SpatialOperationsDump`dbPrint",
"Visualization`VectorFields`VectorFieldsDump`dbPrint",
"Wavelets`WaveletUtilities`dbPrint",
"PacletManager`LayoutDocsCollection`Private`dbStrm",
"PacletManager`LayoutDocsCollection`Private`dbStrm$",
"Charting`CommonDump`dbstyle",
"Charting`ChartLabelingDump`dbTimingReap",
"Charting`ChartLabelingDump`dbVpp", "Charting`ParserDump`dbVpp",
"System`ListPointPlot3DDump`dbVpp",
"System`ListPointPlot3DDump`System`ListPointPlot3DDump`dbVpp" *)
Hello @rhermans, thank you for your extremely clear answer.
â Gennaro Arguzzi
Aug 8 at 17:06
"It's not an amount of a physical quantity, but a the logarithm of a ratio of two quantities in the same units, therefore unitless. " Hmm⦠butUnitConvert[Quantity[40, "AngularDegrees"], "Radians"]
works.
â xzczd
Aug 8 at 17:12
@xzczd remember that with theUnits
package "The conversion of temperature units is different from most other unit conversions because it is not multiplicative. This is simply because the zeros of various systems are set at different values. For example, zero degrees Centigrade is the same as 32 degrees Fahrenheit." so you had to useConvertTemperature
instead ofConvert
. Is not that there are no ways around, but these are special cases. And radians is closer to the idea of a units, as they are amounts of $pi$
â rhermans
Aug 8 at 17:17
Well,"AngularDegrees"
isn't a unit for temperature, it's a unit for angle, which is dimensionless. With this example I just want to illustrate that dimensionless or unitless doesn't seem to be a reason for the "failure" of Mathematica.
â xzczd
Aug 8 at 17:25
1
UnitConvert
will callInternal`MWACompute["MWAToQuantity", name]
to use WolframAlpha to assist with units when the unitname
is not among the built-in ones. Now W|A can convert between decibels and bels, butUnitConvert
cannot. So the call to W|A might only result in anIndependentUnit
that cannot be converted.
â Michael E2
Aug 8 at 18:36
 |Â
show 2 more comments
up vote
6
down vote
accepted
There is nothing in the documentation, and bellow you can see what you can find in the internal functions, of which nothing that seems to do the job. So the answer to your question is:
No, there is no built-in function to convert decibels to amplitude in Mathematica.
Speculation on "why"
We can only guess why the developers didn't implement this, a possible narrative may be similar to the case of the now deprecated Units
Package. There the documentation said:
"The conversion of temperature units is different from most other unit
conversions because it is not multiplicative. This is simply because
the zeros of various systems are set at different values. For example,
zero degrees Centigrade is the same as 32 degrees Fahrenheit."
So you had to use ConvertTemperature
instead of Convert
. How is that similar? It's similar because both cases are somehow special. Wikipedia says
The decibel (symbol: dB) is a unit of measurement used to express the
ratio of one value of a physical property to another on a logarithmic
scale.
dB is NOT an amount of a physical quantity, but a the logarithm of a ratio of two quantities in the same units, therefore unitless and non-linear. Also depending if the you are talking about amplitudes or power (amplitude squared) the factors are 20 or 10.
Therefore, non-linear relationship of something that arguably may not be even a unit with a potentially ambiguous definition... better leave it to the users to define their own, rather simple, solutions.
A solution
dB2lin[x_] := N[Power[10, x/20]];
lin2dB[x_] := N[20 Log10[x]];
Internal functions
Some functions with matching names
Names["*`*Decibel*", IgnoreCase -> True]
(* "Signal`Utils`decibelQ", "Signal`Utils`decibelQ$",
"CalculateUnits`UnitCommonSymbols`DecibelsMuUnit",
"CalculateUnits`UnitCommonSymbols`CalculateUnits`UnitCommonSymbols`
DecibelsMuUnit", "CalculateUnits`UnitCommonSymbols`DecibelsRUnit",
"CalculateUnits`UnitCommonSymbols`DecibelsVUnit",
"CalculateUnits`UnitCommonSymbols`DecibelsZUnit" *)
Names["*`db*"]
(* "Image`ColorOperationsDump`db",
"Image`ColorOperationsDump`Image`ColorOperationsDump`db",
"Predictions`Private`db",
"Predictions`Private`Predictions`Private`db",
"Statistics`Library`Dump`dbag", "Statistics`Library`Dump`dbag$",
"PacletManager`LayoutDocsCollection`Private`dbFile",
"System`FourierTransformDump`dbgPrintFT",
"Charting`ChartLabelingDump`dbgstyle",
"Charting`ChartLabelingDump`dbgstyle$",
"Charting`ChartLabelingDump`dbox", "Charting`dbPrint",
"Image`ColorOperationsDump`dbPrint", "Image`HumanDump`dbPrint",
"Image`SpatialOperationsDump`dbPrint",
"Visualization`VectorFields`VectorFieldsDump`dbPrint",
"Wavelets`WaveletUtilities`dbPrint",
"PacletManager`LayoutDocsCollection`Private`dbStrm",
"PacletManager`LayoutDocsCollection`Private`dbStrm$",
"Charting`CommonDump`dbstyle",
"Charting`ChartLabelingDump`dbTimingReap",
"Charting`ChartLabelingDump`dbVpp", "Charting`ParserDump`dbVpp",
"System`ListPointPlot3DDump`dbVpp",
"System`ListPointPlot3DDump`System`ListPointPlot3DDump`dbVpp" *)
Hello @rhermans, thank you for your extremely clear answer.
â Gennaro Arguzzi
Aug 8 at 17:06
"It's not an amount of a physical quantity, but a the logarithm of a ratio of two quantities in the same units, therefore unitless. " Hmm⦠butUnitConvert[Quantity[40, "AngularDegrees"], "Radians"]
works.
â xzczd
Aug 8 at 17:12
@xzczd remember that with theUnits
package "The conversion of temperature units is different from most other unit conversions because it is not multiplicative. This is simply because the zeros of various systems are set at different values. For example, zero degrees Centigrade is the same as 32 degrees Fahrenheit." so you had to useConvertTemperature
instead ofConvert
. Is not that there are no ways around, but these are special cases. And radians is closer to the idea of a units, as they are amounts of $pi$
â rhermans
Aug 8 at 17:17
Well,"AngularDegrees"
isn't a unit for temperature, it's a unit for angle, which is dimensionless. With this example I just want to illustrate that dimensionless or unitless doesn't seem to be a reason for the "failure" of Mathematica.
â xzczd
Aug 8 at 17:25
1
UnitConvert
will callInternal`MWACompute["MWAToQuantity", name]
to use WolframAlpha to assist with units when the unitname
is not among the built-in ones. Now W|A can convert between decibels and bels, butUnitConvert
cannot. So the call to W|A might only result in anIndependentUnit
that cannot be converted.
â Michael E2
Aug 8 at 18:36
 |Â
show 2 more comments
up vote
6
down vote
accepted
up vote
6
down vote
accepted
There is nothing in the documentation, and bellow you can see what you can find in the internal functions, of which nothing that seems to do the job. So the answer to your question is:
No, there is no built-in function to convert decibels to amplitude in Mathematica.
Speculation on "why"
We can only guess why the developers didn't implement this, a possible narrative may be similar to the case of the now deprecated Units
Package. There the documentation said:
"The conversion of temperature units is different from most other unit
conversions because it is not multiplicative. This is simply because
the zeros of various systems are set at different values. For example,
zero degrees Centigrade is the same as 32 degrees Fahrenheit."
So you had to use ConvertTemperature
instead of Convert
. How is that similar? It's similar because both cases are somehow special. Wikipedia says
The decibel (symbol: dB) is a unit of measurement used to express the
ratio of one value of a physical property to another on a logarithmic
scale.
dB is NOT an amount of a physical quantity, but a the logarithm of a ratio of two quantities in the same units, therefore unitless and non-linear. Also depending if the you are talking about amplitudes or power (amplitude squared) the factors are 20 or 10.
Therefore, non-linear relationship of something that arguably may not be even a unit with a potentially ambiguous definition... better leave it to the users to define their own, rather simple, solutions.
A solution
dB2lin[x_] := N[Power[10, x/20]];
lin2dB[x_] := N[20 Log10[x]];
Internal functions
Some functions with matching names
Names["*`*Decibel*", IgnoreCase -> True]
(* "Signal`Utils`decibelQ", "Signal`Utils`decibelQ$",
"CalculateUnits`UnitCommonSymbols`DecibelsMuUnit",
"CalculateUnits`UnitCommonSymbols`CalculateUnits`UnitCommonSymbols`
DecibelsMuUnit", "CalculateUnits`UnitCommonSymbols`DecibelsRUnit",
"CalculateUnits`UnitCommonSymbols`DecibelsVUnit",
"CalculateUnits`UnitCommonSymbols`DecibelsZUnit" *)
Names["*`db*"]
(* "Image`ColorOperationsDump`db",
"Image`ColorOperationsDump`Image`ColorOperationsDump`db",
"Predictions`Private`db",
"Predictions`Private`Predictions`Private`db",
"Statistics`Library`Dump`dbag", "Statistics`Library`Dump`dbag$",
"PacletManager`LayoutDocsCollection`Private`dbFile",
"System`FourierTransformDump`dbgPrintFT",
"Charting`ChartLabelingDump`dbgstyle",
"Charting`ChartLabelingDump`dbgstyle$",
"Charting`ChartLabelingDump`dbox", "Charting`dbPrint",
"Image`ColorOperationsDump`dbPrint", "Image`HumanDump`dbPrint",
"Image`SpatialOperationsDump`dbPrint",
"Visualization`VectorFields`VectorFieldsDump`dbPrint",
"Wavelets`WaveletUtilities`dbPrint",
"PacletManager`LayoutDocsCollection`Private`dbStrm",
"PacletManager`LayoutDocsCollection`Private`dbStrm$",
"Charting`CommonDump`dbstyle",
"Charting`ChartLabelingDump`dbTimingReap",
"Charting`ChartLabelingDump`dbVpp", "Charting`ParserDump`dbVpp",
"System`ListPointPlot3DDump`dbVpp",
"System`ListPointPlot3DDump`System`ListPointPlot3DDump`dbVpp" *)
There is nothing in the documentation, and bellow you can see what you can find in the internal functions, of which nothing that seems to do the job. So the answer to your question is:
No, there is no built-in function to convert decibels to amplitude in Mathematica.
Speculation on "why"
We can only guess why the developers didn't implement this, a possible narrative may be similar to the case of the now deprecated Units
Package. There the documentation said:
"The conversion of temperature units is different from most other unit
conversions because it is not multiplicative. This is simply because
the zeros of various systems are set at different values. For example,
zero degrees Centigrade is the same as 32 degrees Fahrenheit."
So you had to use ConvertTemperature
instead of Convert
. How is that similar? It's similar because both cases are somehow special. Wikipedia says
The decibel (symbol: dB) is a unit of measurement used to express the
ratio of one value of a physical property to another on a logarithmic
scale.
dB is NOT an amount of a physical quantity, but a the logarithm of a ratio of two quantities in the same units, therefore unitless and non-linear. Also depending if the you are talking about amplitudes or power (amplitude squared) the factors are 20 or 10.
Therefore, non-linear relationship of something that arguably may not be even a unit with a potentially ambiguous definition... better leave it to the users to define their own, rather simple, solutions.
A solution
dB2lin[x_] := N[Power[10, x/20]];
lin2dB[x_] := N[20 Log10[x]];
Internal functions
Some functions with matching names
Names["*`*Decibel*", IgnoreCase -> True]
(* "Signal`Utils`decibelQ", "Signal`Utils`decibelQ$",
"CalculateUnits`UnitCommonSymbols`DecibelsMuUnit",
"CalculateUnits`UnitCommonSymbols`CalculateUnits`UnitCommonSymbols`
DecibelsMuUnit", "CalculateUnits`UnitCommonSymbols`DecibelsRUnit",
"CalculateUnits`UnitCommonSymbols`DecibelsVUnit",
"CalculateUnits`UnitCommonSymbols`DecibelsZUnit" *)
Names["*`db*"]
(* "Image`ColorOperationsDump`db",
"Image`ColorOperationsDump`Image`ColorOperationsDump`db",
"Predictions`Private`db",
"Predictions`Private`Predictions`Private`db",
"Statistics`Library`Dump`dbag", "Statistics`Library`Dump`dbag$",
"PacletManager`LayoutDocsCollection`Private`dbFile",
"System`FourierTransformDump`dbgPrintFT",
"Charting`ChartLabelingDump`dbgstyle",
"Charting`ChartLabelingDump`dbgstyle$",
"Charting`ChartLabelingDump`dbox", "Charting`dbPrint",
"Image`ColorOperationsDump`dbPrint", "Image`HumanDump`dbPrint",
"Image`SpatialOperationsDump`dbPrint",
"Visualization`VectorFields`VectorFieldsDump`dbPrint",
"Wavelets`WaveletUtilities`dbPrint",
"PacletManager`LayoutDocsCollection`Private`dbStrm",
"PacletManager`LayoutDocsCollection`Private`dbStrm$",
"Charting`CommonDump`dbstyle",
"Charting`ChartLabelingDump`dbTimingReap",
"Charting`ChartLabelingDump`dbVpp", "Charting`ParserDump`dbVpp",
"System`ListPointPlot3DDump`dbVpp",
"System`ListPointPlot3DDump`System`ListPointPlot3DDump`dbVpp" *)
edited Aug 8 at 17:53
answered Aug 8 at 17:01
rhermans
21.6k439103
21.6k439103
Hello @rhermans, thank you for your extremely clear answer.
â Gennaro Arguzzi
Aug 8 at 17:06
"It's not an amount of a physical quantity, but a the logarithm of a ratio of two quantities in the same units, therefore unitless. " Hmm⦠butUnitConvert[Quantity[40, "AngularDegrees"], "Radians"]
works.
â xzczd
Aug 8 at 17:12
@xzczd remember that with theUnits
package "The conversion of temperature units is different from most other unit conversions because it is not multiplicative. This is simply because the zeros of various systems are set at different values. For example, zero degrees Centigrade is the same as 32 degrees Fahrenheit." so you had to useConvertTemperature
instead ofConvert
. Is not that there are no ways around, but these are special cases. And radians is closer to the idea of a units, as they are amounts of $pi$
â rhermans
Aug 8 at 17:17
Well,"AngularDegrees"
isn't a unit for temperature, it's a unit for angle, which is dimensionless. With this example I just want to illustrate that dimensionless or unitless doesn't seem to be a reason for the "failure" of Mathematica.
â xzczd
Aug 8 at 17:25
1
UnitConvert
will callInternal`MWACompute["MWAToQuantity", name]
to use WolframAlpha to assist with units when the unitname
is not among the built-in ones. Now W|A can convert between decibels and bels, butUnitConvert
cannot. So the call to W|A might only result in anIndependentUnit
that cannot be converted.
â Michael E2
Aug 8 at 18:36
 |Â
show 2 more comments
Hello @rhermans, thank you for your extremely clear answer.
â Gennaro Arguzzi
Aug 8 at 17:06
"It's not an amount of a physical quantity, but a the logarithm of a ratio of two quantities in the same units, therefore unitless. " Hmm⦠butUnitConvert[Quantity[40, "AngularDegrees"], "Radians"]
works.
â xzczd
Aug 8 at 17:12
@xzczd remember that with theUnits
package "The conversion of temperature units is different from most other unit conversions because it is not multiplicative. This is simply because the zeros of various systems are set at different values. For example, zero degrees Centigrade is the same as 32 degrees Fahrenheit." so you had to useConvertTemperature
instead ofConvert
. Is not that there are no ways around, but these are special cases. And radians is closer to the idea of a units, as they are amounts of $pi$
â rhermans
Aug 8 at 17:17
Well,"AngularDegrees"
isn't a unit for temperature, it's a unit for angle, which is dimensionless. With this example I just want to illustrate that dimensionless or unitless doesn't seem to be a reason for the "failure" of Mathematica.
â xzczd
Aug 8 at 17:25
1
UnitConvert
will callInternal`MWACompute["MWAToQuantity", name]
to use WolframAlpha to assist with units when the unitname
is not among the built-in ones. Now W|A can convert between decibels and bels, butUnitConvert
cannot. So the call to W|A might only result in anIndependentUnit
that cannot be converted.
â Michael E2
Aug 8 at 18:36
Hello @rhermans, thank you for your extremely clear answer.
â Gennaro Arguzzi
Aug 8 at 17:06
Hello @rhermans, thank you for your extremely clear answer.
â Gennaro Arguzzi
Aug 8 at 17:06
"It's not an amount of a physical quantity, but a the logarithm of a ratio of two quantities in the same units, therefore unitless. " Hmm⦠but
UnitConvert[Quantity[40, "AngularDegrees"], "Radians"]
works.â xzczd
Aug 8 at 17:12
"It's not an amount of a physical quantity, but a the logarithm of a ratio of two quantities in the same units, therefore unitless. " Hmm⦠but
UnitConvert[Quantity[40, "AngularDegrees"], "Radians"]
works.â xzczd
Aug 8 at 17:12
@xzczd remember that with the
Units
package "The conversion of temperature units is different from most other unit conversions because it is not multiplicative. This is simply because the zeros of various systems are set at different values. For example, zero degrees Centigrade is the same as 32 degrees Fahrenheit." so you had to use ConvertTemperature
instead of Convert
. Is not that there are no ways around, but these are special cases. And radians is closer to the idea of a units, as they are amounts of $pi$â rhermans
Aug 8 at 17:17
@xzczd remember that with the
Units
package "The conversion of temperature units is different from most other unit conversions because it is not multiplicative. This is simply because the zeros of various systems are set at different values. For example, zero degrees Centigrade is the same as 32 degrees Fahrenheit." so you had to use ConvertTemperature
instead of Convert
. Is not that there are no ways around, but these are special cases. And radians is closer to the idea of a units, as they are amounts of $pi$â rhermans
Aug 8 at 17:17
Well,
"AngularDegrees"
isn't a unit for temperature, it's a unit for angle, which is dimensionless. With this example I just want to illustrate that dimensionless or unitless doesn't seem to be a reason for the "failure" of Mathematica.â xzczd
Aug 8 at 17:25
Well,
"AngularDegrees"
isn't a unit for temperature, it's a unit for angle, which is dimensionless. With this example I just want to illustrate that dimensionless or unitless doesn't seem to be a reason for the "failure" of Mathematica.â xzczd
Aug 8 at 17:25
1
1
UnitConvert
will call Internal`MWACompute["MWAToQuantity", name]
to use WolframAlpha to assist with units when the unit name
is not among the built-in ones. Now W|A can convert between decibels and bels, but UnitConvert
cannot. So the call to W|A might only result in an IndependentUnit
that cannot be converted.â Michael E2
Aug 8 at 18:36
UnitConvert
will call Internal`MWACompute["MWAToQuantity", name]
to use WolframAlpha to assist with units when the unit name
is not among the built-in ones. Now W|A can convert between decibels and bels, but UnitConvert
cannot. So the call to W|A might only result in an IndependentUnit
that cannot be converted.â Michael E2
Aug 8 at 18:36
 |Â
show 2 more comments
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f179697%2fconvert-decibels-to-amplitude-built-in-function%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
10^(amplitudeIndB/20.)
â andre
Aug 8 at 16:14
Hello @andre, I am looking for a built-in function that does the same thing.
â Gennaro Arguzzi
Aug 8 at 16:17
1
Why insist on built-in? I think answer will be no such built-in, although the external resources (databases, W|A) continue to evolve, I think. W|A does not seem currently to be able to recognize "amplitude ratio" or the ISO term "root-power quantity," which does not seem to be an ISO unit per se or have a unit name/symbol.
â Michael E2
Aug 8 at 17:27
1
@MichaelE2 The confusing part is, the document of
Quantity
claims that "Supported units include all those specified by NIST Special Publication 811. " And decibel is indeed mentioned thereâ¦â xzczd
Aug 8 at 17:48
1
@xzczd Yes, I knew. I thought you would point out that
UnitConvert
cannot convert decibels to bels, though. It says they are incompatible (Quantity::compat
), which seems an error to me. It seems anIndependentUnit
is treated as having "no relationship to other units within a Quantity."â Michael E2
Aug 8 at 18:38