Units in Matlab

From biophysics
Revision as of 12:47, 18 March 2024 by Lof (talk | contribs) (Created page with "==Introduction== There are several ways to use variables with units in a program. Space probes have crashed on Mars due to invalid assumptions about units for some variables....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

There are several ways to use variables with units in a program. Space probes have crashed on Mars due to invalid assumptions about units for some variables. So how can we avoid this type of disasters? We have to make it as simple as possible!

We have the SI-units of the Franse Système international d'unités:

Meter (m) - Unit of length
Kilogram (kg) - Unit of mass
Second (s) - Unit of time
Ampere (A) - Unit of electric current
Kelvin (K) - Unit of temperature
Mole (mol) - Unit of amount of substance
Candela (cd) - Unit of luminous intensity

Cominations of these units like m/s are also considered SI- units, and also units that can be expressed in terms of SI-units but have their own name like: Newton (kg.m/s²) or Pascal (N/s²)


The main rule is:

  • Use only variables in SI units inside a program
  • Do calculations only on basic SI units
  • When using
  • If an interface (input or output) has other units convert them to SI units