## Work with units to calculate physical quantities

Dimensional analysis is a technique that revealsthe relationship between different physical quantities in equations. A dimension—for example, length—is a measure of a physical quantity without an assigned value. A unit—for example, meter, inch, or mile—assigns the relative value of a number or measurement to that dimension.With important exceptions, numerical quantities without units do not generally provide useful information. For example, “6 feet” is meaningful, but “6” and “feet” alone are not. Dimensional analysis verifies mathematical computations by providing tools to:

**Convert between units.**You can use dimensional analysis to convert one unit of measure into another without changing the quantity, using a ratio called a unit conversion factor.**Check for unit consistency.**You can use dimensional analysis to verifythat derivedequations accurately represent the physics by checking the consistency of units.**Find dimensionless constants.**You can use dimensional analysis to eliminate dimensions from equations and determine unitless constants that describe the behavior of a system.**Derive the relation between physical quantities.**If you know the numerical values of physical quantities from a real-world scenario, you can use dimensional analysis to derive the relation between the physical quantities by equating the dimensions on each side.

## Examples of Dimensional Analysis

You can use MATLAB^{®} and Symbolic Math Toolbox™ to perform dimensional analysis tasks.

- To convert between units:

You can use dimensional analysis to convert between units. For example, the following MATLAB code converts 50 inches to centimeters: - Check for unit consistency:

You can use dimensional analysis to check that you are comparing numerical quantities measured on the same scale. For example, the following MATLAB code checks for consistency of units in an equation:

$$u=symunit;$$

$$length=unitConvert(50*u.in,u.cm)$$

Executing this code returns the length in cm:

$$length=127cm$$

$$u=symunit;$$

$$syms A \; B;$$

$$eqn=A*u.m/u.s==B*u.kg/u.s$$

$$consistent=checkUnits(eqn,'Compatible')$$

Executing this code returns a boolean indicating whether the units are consistent (1) or inconsistent (0):

$$eqn = A\frac{m}{s} =B\frac{kg}{s}$$

$$consistent= logical$$

### Examples and How To

- Using Units in Physics - Example
- Computational Mathematics in Symbolic Math Toolbox - Example
- Analytical Plotting with Symbolic Math Toolbox - Example
- Numerical Computations with High Precision - Example
- Update an Existing Model to Use Units - Example
- Create Analytical Models for Simscape - Example

### Software Reference

- Symbolic Computations in MATLAB - Documentation
- Units of Measurement - Documentation

*See also:
Computer algebra system,
mathematical modeling,
analytical solution,
Symbolic Math Toolbox,
Live Editor,
Integral
*