定义新的单位
使用。加载符号单元集合symunit
.查找有关预定义单元的信息u.c_0
光速。
u = symunit;unitInfo (u.c_0)
真空中的光速-速度的物理单位。通过调用unitInfo('Velocity')获得测量'Velocity'的所有单位。
说明光速在国际单位制中的准确值为299792458
米每秒。
c = unitConvert (u.c_0“SI”)
c = 299792458 * ([m] / [s])
定义新单位speedOfLightApprox
为光速的近似值3 e8
米每秒。
u = symunit;c = newUnit (speedOfLightApprox, 3 e8 * u.m /美国)
c = [speedOfLightApprox]
或者,您可以使用u.speedOfLightApprox
.
定义方程E=米c2使用新设备。
Syms质量m =质量*u.kg;E = m * c ^ 2
E =质量*(公斤)* (speedOfLightApprox) ^ 2
重写E
用米每秒来表示。
E =重写(E, u.m /美国)
E = 90000000000000000 *质量*(((公斤)* [m] ^ 2) / [s] ^ 2)
因为能量的标准单位是焦耳,重写一下E
而言,焦耳
.
E =重写(E, u.Joule)
E = 90000000000000000 *质量* [J]
checkUnits
|isUnit
|removeUnit
|separateUnits
|symunit
|str2symunit
|symunit2str
|unitConversionFactor