File Exchange

image thumbnail

Working with physical properties and units in Matlab

version (5.99 KB) by Alexander
This submission provides a tool for working with physical units in Matlab.


Updated 05 Mar 2013

View License

Working with units:
>> s = unit('120 k:m') % define distance
s = 120000 m
>> t = unit('1 h') % define time interval
t = 3600 s
>> v = s / t % compute velocity
v = 33.3333 m s-1
>> v.ConvertToDisp('k:m/h') % show v in kilometers per hour
v = 120 k:m/h
>> v.ConvertToDisp('mi/h') % show v in miles per hour
v = 74.5645 mi/h

Convert the gas constant R=8.314 J/mol K to british thermal units per pound-mole and Rankine:
>> unit('8.314 J/mol K').ConvertTo('btu/lb-mol R')
ans =

Comments and Ratings (0)

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor