DimVar

A class for handling dimensioned variables in Matlab

https://github.com/tgvoskuilen/MatlabTools

이 제출물을 팔로우합니다

DimVar is a class is for handling dimensioned quantities in Matlab.
It is designed to be a "stand-in" replacement for numeric data in Matlab that carries units and checks them during normal operations.
For example, you could use it to calculate conduction with mixed units as:
k = DimVar(4,'BTU-in/hr-ft^2-F');
L = DimVar(5,'mm');
A = DimVar(10,'cm^2');
DT = DimVar(500,'R') - DimVar(200,'K');

Q = k*A/L*DT;

where in this case the units are carried through to get Q in Watts. It also checks
for unit validity in math operations, so the following would generate an error:

x = k + L

since the units of k and L are different. However,

x = L + sqrt(A);
y = exp(-x/L);
V = A*L;

would be allowed.

The rules for writing the unit string are:
* Use a single solidus (/) as the separator between numerator and denominator.
* Use hyphens (-) to separate individual unit components
* Indicate powers either with or without a '^' (m^3 or m3)
* Indicate inverse units as either 1/x or x^-1
* Temperatures will be treated as absolute unless you add the optional 'Relative' argument, as in

DT = DimVar(10,'C','Relative')

otherwise the 10 C value will be converted to 283.15 K rather than 10 K. You can also deal with it by using the subtraction, so

DT = DimVar(10,'C') - DimVar(0,'C')

The most up-to-date version of this class is hosted on Github at:
http://github.com/tgvoskuilen/MatlabTools

인용 양식

Tyler V (2026). DimVar (https://github.com/tgvoskuilen/MatlabTools), GitHub. 검색 날짜: .

카테고리

Help CenterMATLAB Answers에서 Numeric Types에 대해 자세히 알아보기

MATLAB 릴리스 호환 정보

  • 모든 릴리스와 호환

플랫폼 호환성

  • Windows
  • macOS
  • Linux

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

버전 퍼블리시됨 릴리스 정보 Action
1.2.0.0

Changed file upload to link directly to GitHub repo

1.1.0.0

Updated array treatment and evaluation of unary functions with dimensionless inputs

1.0.0.0

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