No BSD License  

Highlights from
Unit Conversion Tools

4.0

4.0 | 2 ratings Rate this file 27 Downloads (last 30 days) File Size: 40.4 KB File ID: #16224
image thumbnail

Unit Conversion Tools

by

 

04 Sep 2007 (Updated )

Command line, GUI, & Simulink block to convert physical units

| Watch this File

File Information
Description

Command line, GUI, & Simulink block to convert physical units. It is hoped that relationships between units are specified in an easy to extend manner.

unit_conversion is an m-script that allows one to convert physical units from the command line or a script. It can also provide lists of available transformations.

unit_conversion_gui is a simple graphical interface to unit_conversion.

lib_unit_conversion is a Simulink library block that uses unit_conversion to determine appropriate gains & offsets.

Acknowledgements

Unit Conversion, Units (Updated), Changeunit, and Unit Conversion inspired this file.

MATLAB release MATLAB 7.4 (R2007a)
Other requirements As far as I know, the only required product is MATLAB. If you want to use the block, you will also need Simulink. The Simulink library will pick fixed point data types if you have Simulink Fixed Point, but this isn't required to use the block.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (3)
26 Oct 2009 Turner

The unit_conversion for Fahrenheit is incorrect!

Tried: unit_conversion(0, 'degK','degF')=-255.3722
Should be: unit_conversion(0, 'degK','degF')=−459.67
Tried: unit_conversion(0,'degC','degF')=236.2978
Shuld be: unit_conversion(0,'degC','degF')=32

Also added in two more units and included 'in' aka 'inch' as follows :
'unit',{{'mrad','mradian','mil'}},... %T.J. Modified
'isSI',[0,0,0],...
'gain',.001,...
'bias',0,...
'inv',false),...
struct(...

'unit',{{'moa','MOA'}},... %T.J. Modified
'isSI',[0,0],...
'gain',6283/60/360,...
'bias',0,...
'inv',false),...

'unit',{{'inch','in'}},...
'isSI',[0,0],...
'gain',0.0254,...
'bias',0,...
'inv',false),...
struct(...

% Finally fixed Fahrenheit with following code:
'unit',{{'Fahrenheit','degF'}},...
'isSI',[0,0],...
'gain',5/9,... % kelvin = 5/9 * ( degF - 32 ) + 273.15 = 5/9 * degF - 5/9 * 32 + 273.15
'bias',459.67,... %T.J. modified, %orginal (5/9)*(-32)+273.15
'inv',false),...
struct(...

27 Sep 2007 Ruoyu Cheng

Please bear me with one more comment. It will be very helpful if the authors can provide a help file (.pdf) listing the names or abbreviations of the units involved in this program. Thanks.

27 Sep 2007 Ruoyu Cheng

It is a good program to handle the conversion between different unit systems. The authors' may notice that there is a small mistake in the mass unit conversion, where the "kilogram" was supposed to be the common unit instead of "gram".
Thanks, really good work!

Contact us