mikofski/Quantities

버전 1.3.0.0 (23.4 KB) 작성자: Mark Mikofski
Quantities is an units and uncertainties package for MATLAB.
다운로드 수: 274
업데이트 날짜: 2015/8/17

Quantities is an units and uncertainties package for MATLAB.
Installation
============
Clone or download the Quantities package to your MATLAB folder as `+Quantities`.

Usage
=====
1. Construct a units registry, which contains all units, constants, prefixes and
dimensions.

>> ureg = Quantities.unitRegistry

ureg =

Map with properties:

Count: 279
KeyType: char
ValueType: any

2. Optionally pass `verbosity` parameter to `unitRegistry` to see list of units
loaded.

>> ureg = Quantities.unitRegistry('v',2)

3. Units and constants can be indexed from the `unitRegsitry` using their name
or alias. The `unit`, `constant` and `quantity` class all subclass to
`double` so you can perform any operation on them. Combining a `double` with
a `unit` creates a `quantity` class object.

>> T1 = 45*ureg('celsius')
T1 =
45 ± 0 [degC];

>> T2 = 123.3*ureg.degC
T2 =
123.3 ± 0 [degC];

4. Perform operations. All units are converted to base.

>> T2.to_base
ans =
396.45 ± 0 [kelvin];

>> heat_loss = ureg.stefan_boltzmann_constant*(T1^4 - T2^4)
heat_loss =
-819814 ± 0 [gram*second^-3];

>> heat_loss = ureg.stefan_boltzmann_constant*(T1.to_base^4 - T2.to_base^4)
heat_loss =
-819814 ± 0 [gram*second^-3];

5. Add uncertainty to quantities by calling constructor.

>> T3 = Quantities.quantity(56.2, 1.23, ureg.degC)
T3 =
56.2 ± 1.23 [degC];

>> heat_loss = ureg.stefan_boltzmann_constant*(T1^4 - T3^4)
heat_loss =
-86228.1 ± 9966.66 [gram*second^-3];

6. Convert output to different units.

>> heat_loss_kg = heat_loss.convert(ureg.kg/ureg.s^3)
heat_loss_kg =
-819.814 ± 0 [kilogram*second^-3];

7. Determine arbitrary conversion factor.

>> conversion_factor = ureg.mile.convert(ureg.km)
conversion_factor =
1.60934 ± 0 [kilometer];

인용 양식

Mark Mikofski (2024). mikofski/Quantities (https://github.com/mikofski/Quantities), GitHub. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2015a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 General Physics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

GitHub 디폴트 브랜치를 사용하는 버전은 다운로드할 수 없음

버전 게시됨 릴리스 정보
1.3.0.0

* fix to_base() method to convert units with nested base units, eg: gauss -> tesla -> weber/m^2
* implement convert() methods for unit and quantity classes

1.2.0.0

add package name to unitRegistry calls

1.1.0.0

add readme

1.0.0.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.