comando unit
TRANSCRIPT
-
8/20/2019 Comando Unit
1/13
unit
Physical units
collapse all in page
Use only in the MuPAD Notebook Interface.
This functionality does not run in MATLAB.
Syntax
unit::nam
Description
Objects such as unit::m, unit::kg, unit::sec etc. represent the physical units "meters",
"kilograms", "seconds" etc.
unit domain proides some methods for simplifying and conerting arithmeticale!pressions inoling such units.
unit objects such as unit::m or unit::kg sere for representing physical units. They
are domain objects of domain type unit.
These objects behae like symbolic names identifiers# and can be used to build
arithmetical e!pressions inoling numbers and symbols such
as3*unit::m^2 or a*unit::cm + b*unit::inch^2/unit::mm. $nits must be used
consistently in e!pressions, and should be specified for unkno%n ariables so that the
ariables themseles are dimensionless. &n calls to solve, you should al%ays sole for
dimensionless ariables by specifying the dimensions. 'f. (!ample ).(!pressions such as 20*unit::cm + 0.3*unit::m inoling seeral units of the same type
*length,+ *mass,+ *time+ etc.# are not simplified automatically.
$seunit::convert, unit::simplify, simplify, or Simplify to conert all sube!pressions to
common units. These routines are described further do%n belo%.
On input, use the prefi! unit:: as in unit::mm, unit::km for millimeters, kilometers etc.
On the screen, this prefi! is stripped off. or e!ample,.23*unit::mm is displayed
as .23 mm.
The aailable units are listed further do%n belo%.
-ote that some units such as unit::mm, unit::millimeter and unit::millimeters representthe same physical unit. $se an interactie command such as info!unit::o"# to find
information on unit::o" including all the alternatie names that can be used in MuA/0.
'f. (!ample 1.
Note: Be%are2 &f you mi! different MuA/ units representing the same physical unit, no automatic simp
$se simplify to simplify an e!pression such as 2*unit::m + 3*unit::meter to $*unit::m.
(!pressions such as unit::kg*!unit::m/unit::s#^2 can be used to represent a composite
unit. 3ou can conert them to other units such asunit::%oule ia unit::convert.
4ome of the conersion factors bet%een the arious units are gien by e!act rational
numbers e.g., unit::inch & 2'/$0*unit::cm#, %hile others are linked by floating5point
http://www.mathworks.com/help/symbolic/mupad_ug/glossary.htmlhttp://www.mathworks.com/help/symbolic/mupad_ug/glossary.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/unit.html#buqnypj-1http://www.mathworks.com/help/symbolic/mupad_ref/unit.html#buqnypj-1http://www.mathworks.com/help/symbolic/mupad_ref/simplify.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/simplify1.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/unit.html#unit_infohttp://www.mathworks.com/help/symbolic/mupad_ref/simplify.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/simplify.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/simplify.htmlhttp://www.mathworks.com/help/symbolic/mupad_ug/glossary.htmlhttp://www.mathworks.com/help/symbolic/mupad_ug/glossary.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/unit.html#buqnypj-1http://www.mathworks.com/help/symbolic/mupad_ref/simplify.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/simplify1.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/unit.html#unit_infohttp://www.mathworks.com/help/symbolic/mupad_ref/simplify.html
-
8/20/2019 Comando Unit
2/13
factors e.g., unit::cal & (.))*unit::%oule#. $se oat to appro!imate e!act alues by
floats. $se numeric::rationali"e to appro!imate floats by rational numbers.
Most system functions such as ,i- , factor, normal etc. accept e!pressions containing
units, treating the units like symbolic identifiers. 4ee (!ample 6.
The aailable units are listed belo%. &f the re7uired unit is not aailable, you canuse unit::nenit to add your o%n unit to the unit domain. 4ee (!ample 8.
Length2
• am, f 9 ermi 9 fermi#, 1 9 1u 9 u 9 1#, pm
• 4o 9 4ngstroem 9 angstroem 9 4ngstrom 9 angstrom#
• nm 9 nanometer 9 nanometers#
• 5y 9 micron 9 microns 9 micrometer 9 micrometers#
• mm 9 millimeter 9 millimeters#, cm 9 centimeter 9 centimeters#
• ,m 9 ,ecimeter 9 ,ecimeters#, m 9 meter 9 meters#
• ,am, hm, km 9 kilometer 9 kilometers#, 5m, 6m, 7m, 8m, m
• pt 9 point 9 points#, inch 9 inches 9 "oll 9 9oll#
• ft 9 foot 9 feet#, ftS 9 footS 9 feetS#
• y, 9 yar, 9 yar,s 9 lle 9 llen#, mile 9 miles#, nmile, inm 9 ; 9 l>#, pc 9 parsec#
• ch, fm 9 fathom 9 fathoms#, fur 9 furlong 9 furlongs#, gg, han,
• li 9 link 9 links#, line, mil, ro, 9 perch 9 pole#, span
Mass2
• ag, fg, pg, ng, mcg 9 mcgram 9 mcgrams 9 microgram 9 micrograms#
• mg 9 milligram 9 milligrams#, cg, ,g, g 9 gram 9 grams#, hg
• kg 9 kilogram 9 kilograms#, 5g, 6g, 7g, 8g, g
• t, kt, 5t, ct 9 carat 9 ?t 9 ?arat 9 karat#
• o" 9 ounce 9 ounces 9 n"e 9 n"en 9 un"e 9 un"en#
• lb 9 poun, 9 poun,s#, stone, ct 9 shct#
• ct? 9 longct 9 grossct#, tn 9 ton 9 shortton#, ton?
• longton 9 grosston#, slug, gr, ,r, @uarter, cental
• 8f, 9 8fun, 9 pfun,#, 9tr 9 9entner 9 "entner#
• ," 9 Aoppel"entner 9 ,oppel"entner#
Time2
• as, fs, ps, ns 9 nsec 9 nanosec 9 nanosecon, 9 nanosecon,s#
• mcsec 9 mcsecon, 9 mcsecon,s 9 microsec 9 microsecon, 9 microsecon,s#
• ms 9 msec 9 millisec 9 millisecon, 9 millisecon,s#, cs, ,s
• s 9 sec 9 secon, 9 secon,s 9 Sekun,e 9 Sekun,en#, ,as, hs, ks
http://www.mathworks.com/help/symbolic/mupad_ref/float.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/float.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/numeric-rationalize.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/numeric-rationalize.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/diff.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/factor.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/normal1.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/unit.html#unit_systemfunctionshttp://www.mathworks.com/help/symbolic/mupad_ref/unit.html#unit_newUnithttp://www.mathworks.com/help/symbolic/mupad_ref/float.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/numeric-rationalize.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/diff.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/factor.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/normal1.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/unit.html#unit_systemfunctionshttp://www.mathworks.com/help/symbolic/mupad_ref/unit.html#unit_newUnit
-
8/20/2019 Comando Unit
3/13
• 5s, 6s, 7s, s, 8s, min 9 minute 9 minutes 9 5inute 9 5inuten#
• h 9 hour 9 hours 9 Stun,e 9 Stun,en#, , 9 ,ay 9 ,ays 9 7ag 9 7age#
• eek 9 eeks 9 Boche 9 Bochen#, month 9 months 9 5onat 9 5onate#
• year 9 years 9 %ahr 9 %ahre#
Temperature2
• ? 9 kelvin 9 ?elvin#, ahrenheit 9 fahrenheit#, Celsius 9 celsius#
• Dankine 9 rankine#, Deaumur 9 reaumur#
lain Angle2
• ,egree 9 ,egrees#, ra, 9 ra,ian#
4olid Angle2
• sr 9 stera,ian#
/ata 4i:e, 4torage 'apacity2
• bit 9 Eit# kbit 9 kEit#, 5bit 9 5Eit#, 6bit 9 6Eit#, 7bit 9 7Eit#
• byte 9 Eyte#, kbyte 9 kEyte#, 5byte 9 5Eyte#, 6byte 9 6Eyte#
• 7byte 9 7Eyte#
/ata ;ate Bits per 4econd#2
• bps
4ignal ;ate 9 re7uency#2
•
E, 9 Eau, 9 bau,#
-
8/20/2019 Comando Unit
4/13
• ,a
-
8/20/2019 Comando Unit
5/13
•
-
8/20/2019 Comando Unit
6/13
• G 9 Genry 9 henry#
Magnetic lu! /ensity, Magnetic &nductiity2
• 7 9 7esla 9 tesla#, 6 9 6auss 9 gauss#
Magnetic lu!2
• Bb 9 Beber 9 eber#, 5 9 5aell 9 maell#
Magnetic ield 4trength2
• He 9 Herste, 9 oerste,#
Magnetomotie orce 9 (lectric 'urrent#2
• 6b 9 6ilbert 9 gilbert#
Luminous &ntensity2
• fc,, ac,, pc,, nc,, mcc,, mc,, cc,, ,c,, c, 9 can,ela 9 Can,ela#, ,ac,, hc,
• kc,, 5c,, 6c,, 7c,, 8c,, c,, G? , ;?
Luminance2
• sb 9 stilb#, asb 9 apostilb#
Luminous lu!2
• lm 9 lumen#
&lluminance2
• l 9 lu#, ph 9 phot#, n
;adiation2
• langley
;adioactiity2
• aE@, fE@, pE@, nE@, mcE@, mE@, cE@, ,E@, E@ 9 Eec@uerel 9 bec@uerel#, ,aE@
• hE@, kE@, 5E@, 6E@, 7E@, 8E@, E@, Ci 9 Curie#
(7uialent /osage2
• aSv, fSv, pSv, nSv, mcSv, mSv, cSv, ,Sv
• Sv 9 Sievert 9 sievert#, ,aSv, hSv, kSv, 5Sv, 6Sv, 7Sv, 8Sv, Sv
• arem, frem, prem, nrem, mcrem, mrem, crem, ,rem
• rem 9 Dem#, ,arem, hrem, krem, 5rem, 6rem, 7rem, 8rem, rem
Absorbed /osage2
• a6y,f6y,p6y,n6y,mc6y,m6y,c6y,,6y, 6y 9 6ray 9 gray#, ,a6y,h6y,k6y, 56
y, 66y
• 76y,86y,6y, r,
&onising /osage2
• D 9 Doentgen#
-
8/20/2019 Comando Unit
7/13
Lens o%er2
• ,pt 9 ,iopter 9 ,ioptre#
/ynamic inematic
-
8/20/2019 Comando Unit
8/13
Example "
=e add ne% elocity units to the unit domain2
unit::nenit!Spee,Hf=ight & 300000*unit::km/unit::sec#
-o%, the unit unit::Spee,Hf=ight e!ists and can be used like any other unit in
the unit domain. =e use it to define yet another elocity unit2
unit::nenit!BarpK & .$*unit::Spee,Hf=ight#
=e conert the elocity of ?@).8 miles per hour into the ne% speed units2
unit::convert!23.(*unit::mile/unit::hourI unit::Spee,Hf=ight#
unit::convert!23.(*unit::mile/unit::hourI unit::BarpK#
=e erify the ne% units2
unit::convert!unit::Spee,Hf=ightI unit::km/unit::sec#
unit::convert!unit::BarpKI unit::Spee,Hf=ight#
unit::convert!unit::BarpKI unit::km/unit::sec#
Example #
=e create a symbolic e!pression inoling different units of type *length+2
2'*unit::cm + 30*unit::mm
This e!pression is not simplified automatically. =e apply simplify2
simplify!L#
=e conert this length to inch2
unit::convert!LI unit::inch#
http://www.mathworks.com/help/symbolic/mupad_ref/simplify.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/simplify.htmlhttp://www.mathworks.com/help/symbolic/mupad_ref/simplify.html
-
8/20/2019 Comando Unit
9/13
oat!L#
ere is another e!ample for simplification and conersion2
23(*unit::g + .23(*unit::kg*unit::m^2/unit::inch^2
simplify!L#
unit::convert!LI unit::ounce#
The target unit in unit::convert may be an e!pression2
unit::convert!unit::poun,*unit::km/unit::hourI
unit::kg*unit::m/unit::s#
Example $The probably most interesting method of the unit domain is the conersion
routine unit::convert. ien any e!pression inoling units, you can specify a target
unit %hich is to be used to e!press the units2
unit::convert!unit::ounceI unit::kilogram#
The target unit needs not be of the same physical type as the e!pression that is to be
re%ritten. &n the follo%ing e!ample, %e %ish to re%rite a tor7ue gien in "-e%ton
meters"# in terms of units inoling the po%er unit "=att." -ote that a tor7ue is anenergy, i.e., "po%er" multiplied by "time"2
unit::convert!.23*unit::
-
8/20/2019 Comando Unit
10/13
The target unit may be a composite e!pression. =e %ish to re%rite "-e%ton meters" in
terms of "grams," "centimeters," and "milliseconds"2
unit::convert!unit::oule: a unit of energy
4lternative names: unit::%I unit::%ouleI unit::
-
8/20/2019 Comando Unit
11/13
Parameters
nam The name of the physical unit, see the list belo%. 4ome units
such as unit::mm and unit::millimeter represent the same
physical unit.
Metho(s
collapse all
convert ) *on+ert an expression to other units
convert!I targetunit# conerts all units in the arithmetical e!pression to multiples of
the targetunit if possible. The targetunit may be one of the unit objects of type *length,+
*mass+ etc. &t may also be an arithmetical e!pression such as unit::km/unit::sec. &n this
case, ! is re%ritten in terms of the units found in targetunit.
convert2SIunits ) ,e-rite to SI units
convert2S;units!# re%rites all units in the arithmetical e!pression in terms of
corresponding 4& base units.simplify ) *ombine like units in an expression
unit:: simplify!# conerts all units in the arithmetical e!pression to some basic unit
found in , i.e., all length units are e!pressed by the same length unit, all mass units are
e!pressed by the same mass unit, all time units are e!pressed by the same time unit etc.
newUnit ) Define a ne- unit
nenit!nename & epression#
unit::nenit!nename & f*ol,unit# creates a ne% unit that may be addressed
by unit::nename. &ts name nename must be an identifier. &t is declared as the f 5fold
of some unit ol,unit that must be an e!pression such as unit::mm/unit::sec inoling
units proided by the unit domain. The conersion factor f must be an arithmetical
e!pression typically, a numerical conersion factor#.
display ) ormat for output
,isplay!# formats the screen output of the arithmetical e!pression such that the units
appear as a separate factor at the end of each term.
ndUnits ) in( all units in expression
Mn,nits!# returns a set of all units found in the arithmetical e!pression .
Celsius2Fahrenheit ) *on+ert (e/rees *elsius to (e/rees ahrenheit
unit::Celsius2ahrenheit!# conerts a numerical alue representing a temperature in
degrees 'elsius into a numerical alue representing this temperature in degrees
ahrenheit.
Celsius2Kelvin ) *on+ert (e/rees *elsius to 0el+in
unit::Celsius2?elvin!# conerts a numerical alue representing a temperature in
degrees 'elsius into a numerical alue representing this temperature in degrees >elin.
Celsius2Rankine ) *on+ert (e/rees *elsius to (e/rees ,ankine
unit::Celsius2Dankine!# conerts a numerical alue representing a temperature in
degrees 'elsius into a numerical alue representing this temperature in degrees
;ankine.
Celsius2Reaumur ) *on+ert (e/rees *elsius to (e/rees ,eaumur
-
8/20/2019 Comando Unit
12/13
unit::Celsius2Deaumur!# conerts a numerical alue representing a temperature in
degrees 'elsius into a numerical alue representing this temperature in degrees
;eaumur.
Fahrenheit2Celsius ) *on+ert (e/rees ahrenheit to (e/rees *elsius
unit::ahrenheit2Celsius!# conerts a numerical alue representing a temperature in
degrees ahrenheit into a numerical alue representing this temperature in degrees
'elsius.
Fahrenheit2Kelvin ) *on+ert (e/rees ahrenheit to 0el+in
unit::ahrenheit2?elvin!# conerts a numerical alue representing a temperature in
degrees ahrenheit into a numerical alue representing this temperature in degrees
>elin.
Fahrenheit2Rankine ) *on+ert (e/rees ahrenheit to (e/rees ,ankine
unit::ahrenheit2Dankine!# conerts a numerical alue representing a temperature in
degrees ahrenheit into a numerical alue representing this temperature in degrees
;ankine.
Fahrenheit2Reaumur ) *on+ert (e/rees ahrenheit to (e/rees ,eaumur
unit::ahrenheit2Deaumur!# conerts a numerical alue representing a temperature
in degrees ahrenheit into a numerical alue representing this temperature in degrees
;eaumur.
Kelvin2Fahrenheit ) *on+ert 0el+in to (e/rees ahrenheit
unit::?elvin2ahrenheit!# conerts a numerical alue representing a temperature in
degrees >elin into a numerical alue representing this temperature in degrees
ahrenheit.
Kelvin2Celsius ) *on+ert 0el+in to (e/rees *elsiusunit::?elvin2Celsius!# conerts a numerical alue representing a temperature in
degrees >elin into a numerical alue representing this temperature in degrees 'elsius.
Kelvin2Rankine ) *on+ert 0el+in to (e/rees ,ankine
unit::?elvin2Dankine!# conerts a numerical alue representing a temperature in
degrees >elin into a numerical alue representing this temperature in degrees ;ankine.
Kelvin2Reaumur ) *on+ert 0el+in to (e/rees ,eaumur
unit::?elvin2Deaumur!# conerts a numerical alue representing a temperature in
degrees >elin into a numerical alue representing this temperature in degrees
;eaumur.
Rankine2Fahrenheit ) *on+ert (e/rees ,ankine to (e/rees ahrenheit
unit::Dankine2ahrenheit!# conerts a numerical alue representing a temperature in
degrees ;ankine into a numerical alue representing this temperature in degrees
ahrenheit.
Rankine2Kelvin ) *on+ert (e/rees ,ankine to 0el+in
unit::Dankine2?elvin!# conerts a numerical alue representing a temperature in
degrees ;ankine into a numerical alue representing this temperature in degrees >elin.
Rankine2Celsius ) *on+ert (e/rees ,ankine to (e/rees *elsius
unit::Dankine2Celsius!# conerts a numerical alue representing a temperature in
degrees ;ankine into a numerical alue representing this temperature in degrees'elsius.
-
8/20/2019 Comando Unit
13/13
Rankine2Reaumur ) *on+ert (e/rees ,ankine to (e/rees ,eaumur
unit::Dankine2Deaumur!# conerts a numerical alue representing a temperature in
degrees ;ankine into a numerical alue representing this temperature in degrees
;eaumur.
Reaumur2Fahrenheit ) *on+ert (e/rees ,eaumur to (e/rees ahrenheit
unit::Deaumur2ahrenheit!# conerts a numerical alue representing a temperature
in degrees ;eaumur into a numerical alue representing this temperature in degrees
ahrenheit.
Reaumur2Kelvin ) *on+ert (e/rees ,eaumur to 0el+in
unit::Deaumur2?elvin!# conerts a numerical alue representing a temperature in
degrees ;eaumur into a numerical alue representing this temperature in degrees
>elin.
Reaumur2Rankine ) *on+ert (e/rees ,eaumur to (e/rees ,ankine
unit::Deaumur2Dankine!# conerts a numerical alue representing a temperature in
degrees ;eaumur into a numerical alue representing this temperature in degrees;ankine.
Reaumur2Celsius ) *on+ert (e/rees ,eaumur to (e/rees *elsius
unit::Deaumur2Celsius!# conerts a numerical alue representing a temperature in
degrees ;eaumur into a numerical alue representing this temperature in degrees
'elsius.