initializePhysicalC​onstants.m

Creates a structure containing important physical constants (R, k, N_a, g, etc.)
1.1K Downloads
Updated 18 Aug 2007

No License

initializePhysicalConstants.m loads important physical constants into
the structure CONSTS. The CONSTS structure will contain both values
(accessible by CONSTS.var_name), and descriptive information
(CONSTS.desc.var_name.[Name, Units, Value]).
EXAMPLE USAGE:

% What are the units of the unversal gas constant?
CONSTS.desc.R
ans =
Name: 'Gas Constant'
Units: 'J K^-1 mol^-1'
Value: 8.3140

% Atoms in 10 grams of oxygen:
V = 1; %L
P = 1; % atm
T = CONSTS.T_o + 20; % K
nMols = P*V / (CONSTS.R*T)
nMols =
4.1030e-004
% How may atoms?
nAtoms = nMols * CONSTS.N_a
nAtoms =
2.4708e+020

This program can be vastly improved; I'm happy to do so if people
actually use it. (for example: more constants, database functionality,
embedded dimensional information...) Just send me an email (see my
webpage.)

Created: Rob Chambers
http://www.stanford.edu/~robc1
8/16/20007

Free to use or modify, just keep my reference info intact.

Cite As

Rob Chambers (2024). initializePhysicalConstants.m (https://www.mathworks.com/matlabcentral/fileexchange/15957-initializephysicalconstants-m), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2006b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Chemistry in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0