# IMU

**Libraries:**

Sensor Fusion and Tracking Toolbox /
Multisensor Positioning /
Sensor Models

Navigation Toolbox /
Multisensor Positioning /
Sensor Models

## Description

The IMU
Simulink^{®} block models receiving data from an inertial measurement unit (IMU) composed of
accelerometer, gyroscope, and magnetometer sensors. You can specify the reference frame of the
block inputs as the `NED`

(North-East-Down) or `ENU`

(East-North-Up) frame by using the **Reference Frame** parameter.

## Examples

### IMU Sensor Fusion with Simulink

Generate and fuse IMU sensor data using Simulink®. You can accurately model the behavior of an accelerometer, a gyroscope, and a magnetometer and fuse their outputs to compute orientation.

## Ports

### Input

**Linear Acceleration** — Acceleration of IMU in local navigation coordinate system
(m/s^{2})

*N*-by-3 matrix of real scalar

Acceleration of the IMU in the local navigation coordinate system, specified as an
*N*-by-3 matrix of real scalars in meters per second squared.
*N* is the number of samples in the current frame. Do not include
the gravitational acceleration in this input since the sensor models gravitational
acceleration by default.

To specify the orientation of the IMU sensor body frame with respect to the local
navigation frame, use the **Orientation** input port.

**Data Types: **`single`

| `double`

**Angular Velocity** — Angular velocity of IMU in local navigation coordinate system (rad/s)

*N*-by-3 matrix of real scalar

Angular velocity of the IMU sensor body frame in the local navigation coordinate
system, specified as an *N*-by-3 matrix of scalars in radians per
second. *N* is the number of samples in the current frame. To specify
the orientation of the IMU sensor body frame with respect to the local navigation
frame, use the **Orientation** input port.

**Data Types: **`single`

| `double`

**Orientation** — Orientation of IMU in local navigation coordinate system

*N*-by-4 array of real scalar | 3-by-3-by-*N*-element rotation matrix

Orientation of the IMU sensor body frame with respect to the local navigation
coordinate system, specified as an *N*-by-4 array of real scalars or
a 3-by-3-by-*N* rotation matrix. Each row the of the
*N*-by-4 array is assumed to be the four elements of a `quaternion`

(Sensor Fusion and Tracking Toolbox). *N* is the number of samples in the current
frame.

**Data Types: **`single`

| `double`

**Temperature** — Temperature of IMU (℃)

*N*-by-1 vector of real scalar

Temperature of IMU, specified as an *N*-by-1 vector of real
scalars in degrees Celsius.

#### Dependencies

To enable this port, in the **Parameters** tab, select
**Specify temperature from input port**.

**Data Types: **`single`

| `double`

**Magnetic Field** — Magnetic field vector in local navigation coordinate system (μT)

*N*-by-3 matrix of real scalar

Magnetic field vector in the local navigation coordinate system, specified as an
*N*-by-3 matrix of scalars in microteslas.

#### Dependencies

To enable this port, in the **Parameters** tab, select
**Specify magnetic field from input port**.

**Data Types: **`single`

| `double`

### Output

**Accel** — Accelerometer measurement of IMU in sensor body coordinate system
(m/s^{2})

*N*-by-3 matrix of real scalar

Accelerometer measurement of the IMU in the sensor body coordinate system,
returned as an *N*-by-3 matrix of real scalars in meters per second
squared. *N* is the number of samples in the current frame.

**Data Types: **`single`

| `double`

**Gyro** — Gyroscope measurement of IMU in sensor body coordinate system (rad/s)

*N*-by-3 matrix of real scalar

Gyroscope measurement of the IMU in the sensor body coordinate system, returned as
an *N*-by-3 matrix of real scalars in radians per second.
*N* is the number of samples in the current frame.

**Data Types: **`single`

| `double`

**Mag** — Magnetometer measurement of IMU in sensor body coordinate system (μT)

*N*-by-3 matrix of real scalar

Magnetometer measurement of the IMU in the sensor body coordinate system, returned
as an *N*-by-3 matrix of real scalars in microtesla.
*N* is the number of samples in the current frame.

**Data Types: **`single`

| `double`

## Parameters

**Parameters**

**Reference frame** — Navigation reference frame

`NED`

(default) | `ENU`

Navigation reference frame, specified as `NED`

(North-East-Down) or
`ENU`

(East-North-Up).

**Note**

If you choose the NED reference frame, specify the sensor inputs in the NED reference frame. Additionally, the sensor models the gravitational acceleration as [0 0 9.81] m/s

^{2}.If you choose the ENU reference frame, specify the sensor inputs in the ENU reference frame. Additionally, the sensor models the gravitational acceleration as [0 0 −9.81] m/s

^{2}.

**Specify temperature from input port** — Specify temperature from input port

off (default) | on

Select this check box to enable the input of temperature by using the
**Temperature** input port.

**Temperature (**^{o}C) — Operating temperature of IMU (^{o}C)

`25`

(default) | real scalar

^{o}C)

Operating temperature of the IMU in degrees Celsius, specified as a real scalar.

When the block calculates temperature scale factors and environmental drift noises,
25 ^{o}C is used as the nominal temperature.

#### Dependencies

To enable this parameter, unselect **Specify temperature from input
port**.

**Data Types: **`single`

| `double`

**Specify magnetic field from input port** — Specify magnetic field from input port

off (default) | on

Select this check box to enable the input of magnetic field by using the
**Magnetic field** input port.

**Magnetic field (NED)** — Magnetic field vector expressed in NED navigation frame (μT)

`[27.5550, -2.4169, -16.0849]`

(default) | 1-by-3 vector of scalar

Magnetic field vector expressed in the NED navigation frame, specified as a 1-by-3 vector of scalars.

The default magnetic field corresponds to the magnetic field at latitude zero, longitude zero, and altitude zero.

#### Dependencies

To enable this parameter, set **Reference frame** to
`NED`

and unselect **Specify magnetic field from
input port**.

**Data Types: **`single`

| `double`

**MagneticField (ENU)** — Magnetic field vector expressed in ENU navigation frame (μT)

`[-2.4169, 27.5550, 16.0849]`

(default) | 1-by-3 vector of scalar

Magnetic field vector expressed in the ENU navigation frame, specified as a 1-by-3 vector of scalars.

The default magnetic field corresponds to the magnetic field at latitude zero, longitude zero, and altitude zero.

#### Dependencies

To enable this parameter, set **Reference frame** to
`ENU`

and unselect **Specify magnetic field from
input port**.

**Data Types: **`single`

| `double`

**Seed** — Initial seed for randomization

`67`

(default) | nonnegative integer

Initial seed of a random number generator algorithm, specified as a nonnegative integer.

**Data Types: **`single`

| `double`

**Simulate using** — Type of simulation to run

`Interpreted Execution`

(default) | `Code Generation`

`Interpreted execution`

— Simulate the model using the MATLAB^{®}interpreter. This option shortens startup time. In`Interpreted execution`

mode, you can debug the source code of the block.`Code generation`

— Simulate the model using generated C code. The first time that you run a simulation, Simulink generates C code for the block. The C code is reused for subsequent simulations if the model does not change. This option requires additional startup time.

**Accelerometer**

**Maximum readings (m/s**^{2}) — Maximum sensor reading (m/s^{2})

`inf`

(default) | real positive scalar

^{2})

Maximum sensor reading in m/s^{2}, specified as a real
positive scalar.

**Data Types: **`single`

| `double`

**Resolution ((m/s**^{2})/LSB) — Resolution of sensor measurements ((m/s^{2})/LSB)

`0`

(default) | real nonnegative scalar

^{2})/LSB)

Resolution of sensor measurements in (m/s^{2})/LSB,
specified as a real nonnegative scalar.

**Data Types: **`single`

| `double`

**Constant offset bias (m/s**^{2}) — Constant sensor offset bias (m/s^{2})

`[0 0 0]`

(default) | real scalar | real 3-element row vector

^{2})

Constant sensor offset bias in m/s^{2}, specified as a real
scalar or 3-element row vector. Any scalar input is converted into a real 3-element row
vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Axis skew (%)** — Sensor axes skew (%)

`diag([100 100 100])`

(default) | scalar | 3-element row vector | 3-by-3 matrix

Sensor axes skew in percentage, specified as a scalar, a 3-element row vector, or a
3-by-3 matrix. The diagonal elements of the matrix account for the misalignment effects
for each axes. The off-diagonal elements account for the cross-axes misalignment
effects. The measured state
*v*_{measure} is obtained from
the true state *v*_{true} via
the misalignment matrix as:

$${v}_{measure}=\frac{1}{100}M\text{\hspace{0.05em}}{v}_{true}=\frac{1}{100}\left[\begin{array}{ccc}{m}_{11}& {m}_{12}& {m}_{13}\\ {m}_{21}& {m}_{22}& {m}_{23}\\ {m}_{31}& {m}_{32}& {m}_{33}\end{array}\right]{v}_{true}$$

If you specify the property as a scalar, then all the off-diagonal elements of the matrix take the value of the specified scalar and all the diagonal elements are 100.

If you specify the property as a vector [

*a**b**c*], then*m*_{21}=*m*_{31}=*a*,*m*_{12}=*m*_{32}=*b*, and*m*_{13}=*m*_{23}=*c*. All the diagonal elements are 100.

**Data Types: **`single`

| `double`

**Velocity random walk (m/s**^{2}/√Hz) — Velocity random walk (m/s^{2}/√Hz)

`[0 0 0]`

(default) | real scalar | real 3-element row vector

^{2}/√Hz)

Velocity random walk in (m/s^{2}/√Hz), specified as a real
scalar or 3-element row vector. This property corresponds to the power spectral density
of sensor noise. Any scalar input is converted into a real 3-element row vector where
each element has the input scalar value.

**Data Types: **`single`

| `double`

**Bias Instability (m/s**^{2}) — Instability of the bias offset (m/s^{2})

`[0 0 0]`

(default) | real scalar | real 3-element row vector

^{2})

Instability of the bias offset in m/s^{2}, specified as a
real scalar or 3-element row vector. Any scalar input is converted into a real 3-element
row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Bias instability filter numerator coefficients** — Bias instability filter numerator coefficients

`fractalcoef.Numerator`

(default) | real-valued row vector

Bias instability filter numerator coefficients, specified as a real-valued row
vector. To specify coefficients for fractal noise, use the `fractalcoef`

(Sensor Fusion and Tracking Toolbox)
function.

**Data Types: **`single`

| `double`

**Bias instability filter denominator coefficients** — Bias instability filter denominator coefficients

`fractalcoef.Denominator`

(default) | real-valued row vector

Bias instability filter denominator coefficients, specified as a real-valued row
vector. To specify coefficients for fractal noise, use the `fractalcoef`

(Sensor Fusion and Tracking Toolbox)
function.

**Data Types: **`single`

| `double`

**Acceleration random walk ((m/s**^{2})(√Hz)) — Acceleration random walk ((m/s^{2})(√Hz))

`[0 0 0]`

(default) | real scalar | real 3-element row vector

^{2})(√Hz))

Acceleration random walk of sensor in (m/s^{2})(√Hz),
specified as a real scalar or 3-element row vector. Any scalar input is converted into a
real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Noise Type** — Type of random noise

`double-sided`

(default) | `single-sided`

Select the type of random noise as:

`double-sided`

— Random noise coefficients have a scale factor of 2.`single-sided`

— Random noise coefficients have a scale factor of 1.

**Data Types: **`single`

| `double`

**Bias from temperature ((m/s**^{2})/℃) — Sensor bias from temperature ((m/s^{2})/℃)

`[0 0 0]`

(default) | real scalar | real 3-element row vector

^{2})/℃)

Sensor bias from temperature in (m/s^{2})/℃, specified as a
real scalar or 3-element row vector. Any scalar input is converted into a real 3-element
row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Temperature scale factor (%/℃)** — Scale factor error from temperature (%/℃)

`[0 0 0]`

(default) | real scalar in the range [0,100] | real 3-element row vector in the range [0,100]

Scale factor error from temperature in %/℃, specified as a real scalar or real 3-element row vector with values ranging from 0 to 100. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Gyroscope**

**Maximum readings (rad/s)** — Maximum sensor reading (rad/s)

`inf`

(default) | real positive scalar

Maximum sensor reading in rad/s, specified as a real positive scalar.

**Data Types: **`single`

| `double`

**Resolution ((rad/s)/LSB)** — Resolution of sensor measurements ((rad/s)/LSB)

`0`

(default) | real nonnegative scalar

Resolution of sensor measurements in (rad/s)/LSB, specified as a real nonnegative scalar.

**Data Types: **`single`

| `double`

**Constant offset bias (rad/s)** — Constant sensor offset bias (rad/s)

`[0 0 0]`

(default) | real scalar | real 3-element row vector

Constant sensor offset bias in rad/s, specified as a real scalar or 3-element row vector. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Axis skew (%)** — Sensor axes skew (%)

`diag([100 100 100])`

(default) | scalar | 3-element row vector | 3-by-3 matrix

Sensor axes skew in percentage, specified as a scalar, a 3-element row vector, or a
3-by-3 matrix. The diagonal elements of the matrix account for the misalignment effects
for each axes. The off-diagonal elements account for the cross-axes misalignment
effects. The measured state
*v*_{measure} is obtained from
the true state *v*_{true} via
the misalignment matrix as:

$${v}_{measure}=\frac{1}{100}M\text{\hspace{0.05em}}{v}_{true}=\frac{1}{100}\left[\begin{array}{ccc}{m}_{11}& {m}_{12}& {m}_{13}\\ {m}_{21}& {m}_{22}& {m}_{23}\\ {m}_{31}& {m}_{32}& {m}_{33}\end{array}\right]{v}_{true}$$

If you specify the property as a scalar, then all the off-diagonal elements of the matrix take the value of the specified scalar and all the diagonal elements are 100.

If you specify the property as a vector [

*a**b**c*], then*m*_{21}=*m*_{31}=*a*,*m*_{12}=*m*_{32}=*b*, and*m*_{13}=*m*_{23}=*c*. All the diagonal elements are 100.

**Data Types: **`single`

| `double`

**Bias from acceleration ((rad/s)/(m/s**^{2}) — Sensor bias from linear acceleration (rad/s)/(m/s^{2})

`[0 0 0]`

(default) | real scalar | real 3-element row vector

^{2})

Sensor bias from linear acceleration in (rad/s)/(m/s^{2}),
specified as a real scalar or 3-element row vector. Any scalar input is converted into a
real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Angle random walk ((rad/s)/(√Hz))** — Angle random walk ((rad/s)/(√Hz))

`[0 0 0]`

(default) | real scalar | real 3-element row vector

Angle random walk of sensor in (rad/s)/(√Hz), specified as a real scalar or 3-element row vector. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Bias Instability (rad/s)** — Instability of the bias offset (rad/s)

`[0 0 0]`

(default) | real scalar | real 3-element row vector

Instability of the bias offset in rad/s, specified as a real scalar or 3-element row vector. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Bias instability filter numerator coefficients** — Bias instability filter numerator coefficients

`fractalcoef.Numerator`

(default) | real-valued row vector

Bias instability filter numerator coefficients, specified as a real-valued row
vector. To specify coefficients for fractal noise, use the `fractalcoef`

(Sensor Fusion and Tracking Toolbox)
function.

**Data Types: **`single`

| `double`

**Bias instability filter denominator coefficients** — Bias instability filter denominator coefficients

`fractalcoef.Denominator`

(default) | real-valued row vector

Bias instability filter denominator coefficients, specified as a real-valued row
vector. To specify coefficients for fractal noise, use the `fractalcoef`

(Sensor Fusion and Tracking Toolbox)
function.

**Data Types: **`single`

| `double`

**Noise Type** — Type of random noise

`double-sided`

(default) | `single-sided`

Select the type of random noise as:

`double-sided`

— Random noise coefficients have a scale factor of 2.`single-sided`

— Random noise coefficients have a scale factor of 1.

**Data Types: **`single`

| `double`

**Rate random walk ((rad/s)(√Hz))** — Integrated white noise of sensor ((rad/s)(√Hz))

`[0 0 0]`

(default) | real scalar | real 3-element row vector

Integrated white noise of sensor in (rad/s)(√Hz), specified as a real scalar or 3-element row vector. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Bias from temperature ((rad/s)/℃)** — Sensor bias from temperature ((rad/s)/℃)

`[0 0 0]`

(default) | real scalar | real 3-element row vector

Sensor bias from temperature in (rad/s)/℃, specified as a real scalar or 3-element row vector. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Temperature scale factor (%/℃)** — Scale factor error from temperature (%/℃)

`[0 0 0]`

(default) | real scalar in the range [0,100] | real 3-element row vector in the range [0,100]

Scale factor error from temperature in %/℃, specified as a real scalar or real 3-element row vector with values ranging from 0 to 100. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Magnetometer**

**Maximum readings (μT)** — Maximum sensor reading (μT)

`inf`

(default) | real positive scalar

Maximum sensor reading in μT, specified as a real positive scalar.

**Data Types: **`single`

| `double`

**Resolution ((μT)/LSB)** — Resolution of sensor measurements ((μT)/LSB)

`0`

(default) | real nonnegative scalar

Resolution of sensor measurements in (μT)/LSB, specified as a real nonnegative scalar.

**Data Types: **`single`

| `double`

**Constant offset bias (μT)** — Constant sensor offset bias (μT)

`[0 0 0]`

(default) | real scalar | real 3-element row vector

Constant sensor offset bias in μT, specified as a real scalar or 3-element row vector. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Axis skew (%)** — Sensor axes skew (%)

`diag([100 100 100])`

(default) | scalar | 3-element row vector | 3-by-3 matrix

Sensor axes skew in percentage, specified as a scalar, a 3-element row vector, or a
3-by-3 matrix. The diagonal elements of the matrix account for the misalignment effects
for each axes. The off-diagonal elements account for the cross-axes misalignment
effects. The measured state
*v*_{measure} is obtained from
the true state *v*_{true} via
the misalignment matrix as:

$${v}_{measure}=\frac{1}{100}M\text{\hspace{0.05em}}{v}_{true}=\frac{1}{100}\left[\begin{array}{ccc}{m}_{11}& {m}_{12}& {m}_{13}\\ {m}_{21}& {m}_{22}& {m}_{23}\\ {m}_{31}& {m}_{32}& {m}_{33}\end{array}\right]{v}_{true}$$

If you specify the property as a scalar, then all the off-diagonal elements of the matrix take the value of the specified scalar and all the diagonal elements are 100.

If you specify the property as a vector [

*a**b**c*], then*m*_{21}=*m*_{31}=*a*,*m*_{12}=*m*_{32}=*b*, and*m*_{13}=*m*_{23}=*c*. All the diagonal elements are 100.

**White noise PSD (μT/√Hz)** — Power spectral density of sensor noise (μT/√Hz)

`[0 0 0]`

(default) | real scalar | real 3-element row vector

Power spectral density of sensor noise in μT/√Hz, specified as a real scalar or 3-element row vector. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Bias Instability (μT)** — Instability of the bias offset (μT)

`[0 0 0]`

(default) | real scalar | real 3-element row vector

Instability of the bias offset in μT, specified as a real scalar or 3-element row vector. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Bias instability filter numerator coefficients** — Bias instability filter numerator coefficients

`fractalcoef.Numerator`

(default) | real-valued row vector

Bias instability filter numerator coefficients, specified as a real-valued row
vector. To specify coefficients for fractal noise, use the `fractalcoef`

(Sensor Fusion and Tracking Toolbox)
function.

**Data Types: **`single`

| `double`

**Bias instability filter denominator coefficients** — Bias instability filter denominator coefficients

`fractalcoef.Denominator`

(default) | real-valued row vector

Bias instability filter denominator coefficients, specified as a real-valued row
vector. To specify coefficients for fractal noise, use the `fractalcoef`

(Sensor Fusion and Tracking Toolbox)
function.

**Data Types: **`single`

| `double`

**Noise Type** — Type of random noise

`double-sided`

(default) | `single-sided`

Select the type of random noise as:

`double-sided`

— Random noise coefficients have a scale factor of 2.`single-sided`

— Random noise coefficients have a scale factor of 1.

**Data Types: **`single`

| `double`

**Random walk ((μT)*√Hz)** — Integrated white noise of sensor ((μT)*√Hz)

`[0 0 0]`

(default) | real scalar | real 3-element row vector

Integrated white noise of sensor in (μT)*√Hz, specified as a real scalar or 3-element row vector. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Bias from temperature (μT/℃)** — Sensor bias from temperature (μT/℃)

`[0 0 0]`

(default) | real scalar | real 3-element row vector

Sensor bias from temperature in μT/℃, specified as a real scalar or 3-element row vector. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

**Temperature scale factor (%/℃)** — Scale factor error from temperature (%/℃)

`[0 0 0]`

(default) | real scalar in the range [0,100] | real 3-element row vector in the range [0,100]

Scale factor error from temperature in %/℃, specified as a real scalar or real 3-element row vector with values ranging from 0 to 100. Any scalar input is converted into a real 3-element row vector where each element has the input scalar value.

**Data Types: **`single`

| `double`

## Algorithms

### Accelerometer

The following algorithm description assumes an NED navigation frame. The accelerometer model
uses the ground-truth orientation and acceleration inputs and the `imuSensor`

and `accelparams`

properties to model accelerometer readings.

**Obtain Total Acceleration**

To obtain the total acceleration (*totalAcc*), the acceleration is
preprocessed by negating and adding the gravity constant vector (*g*=
[0; 0; 9.8] m/s^{2} assuming an NED frame) as:

$$totalAcc=-acceleration+g$$

The `acceleration`

term is negated to obtain zero
total acceleration readings when the accelerometer is in a free fall. The
`acceleration`

term is also known as the specific force.

**Convert to Sensor Frame**

Then the total acceleration is converted from the local navigation frame to the sensor frame using:

$$a=\left(orientation\right){\left(totalAcc\right)}^{T}$$

If the orientation is input in quaternion form, it is converted to a rotation matrix before processing.

**Bulk Model**

The ground-truth acceleration in the sensor frame, *a*, passes through the bulk model, which adds axes misalignment and bias:

$$b={\left(\left[\begin{array}{ccc}1& \frac{{\alpha}_{2}}{100}& \frac{{\alpha}_{3}}{100}\\ \frac{{\alpha}_{1}}{100}& 1& \frac{{\alpha}_{3}}{100}\\ \frac{{\alpha}_{1}}{100}& \frac{{\alpha}_{2}}{100}& 1\end{array}\right]\left({a}^{T}\right)\right)}^{T}+\text{ConstantBias}$$

where ConstantBias is a property of `accelparams`

, and *α*_{1}, *α*_{2}, and *α*_{3} are given by the first, second, and third elements of the AxesMisalignment property of `accelparams`

.

**Bias Instability Drift**

The bias instability drift *β*_{1} is modeled as white
noise biased and then filtered:

$$\begin{array}{l}{g}_{1}{\beta}_{1}(k)=-{g}_{2}{\beta}_{1}(k-1)-{g}_{3}{\beta}_{1}(k-2)\dots -{g}_{n+1}{\beta}_{1}(k-n)\\ +{f}_{1}x(k)+{f}_{2}x(k-1)+\dots +{f}_{m+1}x(k-m)\\ x(k)=(\text{BiasInstability})w(k)\end{array}$$

where *k* is the discrete time step index, BiasInstability is
a property of `accelparams`

,
*w* is white noise that follows a normal distribution of mean 0 and
variance of 1. The discrete time step size is the reciprocal of the SampleRate
property. [*g*_{1},
*g*_{2}, …,
*g*_{n+1}] are the
denominator coefficients specified in the
`BiasInstabilityCoefficients`

property of the `accelparams`

object.
[*f*_{1},
*f*_{2}, …,
*f*_{m+1}] are the
numerator coefficients of the `BiasInstabilityCoefficients`

property.
*n* and *m* are the orders of the denominator and
numerator coefficients, respectively.

**White Noise Drift**

White noise drift is modeled by multiplying elements of the white noise random stream by the standard deviation:

$${\beta}_{2}=\left(w\right)\left(\sqrt{\frac{\text{SampleRate}}{s}}\right)\left(\text{NoiseDensity}\right)$$

where *w* is white noise that follows a normal
distribution of mean 0 and variance of 1, SampleRate is an
`imuSensor`

property, and NoiseDensity is an
`accelparams`

property.
The scale variable *s* = 2 if the `NoiseType`

property of the `accelparams`

object is
double-sided and *s* = 1 if the `NoiseType`

property is single-sided.

**Random Walk Drift**

The random walk drift is modeled by biasing elements of the white noise random stream and then filtering:

$${\beta}_{3}(k)={\beta}_{2}(k-1)+w(k)\left(\frac{\text{RandomWalk}}{\sqrt{\frac{\text{SampleRate}}{s}}}\right)$$

where *k* is the discrete time step index, RandomWalk is a
property of `accelparams`

, SampleRate is a
property of `imuSensor`

, *w* is white noise that follows
a normal distribution of mean 0 and variance of 1. The discrete time step size is the
reciprocal of the SampleRate
property. The scale variable *s* = 2 if the
`NoiseType`

property of the `accelparams`

object is
double-sided and *s* = 1 if the `NoiseType`

property is single-sided.

**Environmental Drift Noise**

The environmental drift noise is modeled by multiplying the temperature difference from a standard with the temperature bias:

$${\Delta}_{e}=(\text{Temperature}-25)(\text{TemperatureBias})$$

where Temperature is a property of `imuSensor`

, and TemperatureBias is a property of `accelparams`

. The constant 25 corresponds to a standard temperature.

**Scale Factor Error Model**

The temperature scale factor error is modeled as:

$$scaleFactorError=1+\left(\frac{\text{Temperature}-25}{100}\right)(\text{TemperatureScaleFactor})$$

where Temperature is a property of `imuSensor`

, and TemperatureScaleFactor is a property of `accelparams`

. The constant 25 corresponds to a standard temperature.

**Quantization Model**

The quantization is modeled by first saturating the continuous signal model:

$$e=\{\begin{array}{c}\begin{array}{c}\text{MeasurementRange}\\ -\text{MeasurementRange}\end{array}\\ d\end{array}\begin{array}{c}\\ \\ \end{array}\begin{array}{c}\text{if}\\ \text{if}\\ \text{else}\end{array}\begin{array}{c}\\ \\ \end{array}\begin{array}{c}d>\text{MeasurementRange}\\ -d>\text{MeasurementRange}\\ \end{array}$$

and then setting the resolution:

$$accelReadings=(\text{Resolution})\left(\mathrm{round}\left(\frac{e}{\text{Resolution}}\right)\right)$$

where MeasurementRange is a property of `accelparams`

.

### Gyroscope

The following algorithm description assumes an NED navigation frame. The gyroscope model uses
the ground-truth orientation, acceleration, and angular velocity inputs, and the
`imuSensor`

and `gyroparams`

properties to model accelerometer readings.

**Convert to Sensor Frame**

The ground-truth angular velocity is converted from the local frame to the sensor frame using the ground-truth orientation:

$$a=\left(orientation\right){\left(angularVelocity\right)}^{T}$$

If the orientation is input in quaternion form, it is converted to a rotation matrix before processing.

**Bulk Model**

The ground-truth angular velocity in the sensor frame, *a*, passes through the bulk model, which adds axes misalignment and bias:

$$b={\left(\left[\begin{array}{ccc}1& \frac{{\alpha}_{2}}{100}& \frac{{\alpha}_{3}}{100}\\ \frac{{\alpha}_{1}}{100}& 1& \frac{{\alpha}_{3}}{100}\\ \frac{{\alpha}_{1}}{100}& \frac{{\alpha}_{2}}{100}& 1\end{array}\right]\left({a}^{T}\right)\right)}^{T}+\text{ConstantBias}$$

where ConstantBias is a property of `gyroparams`

, and *α*_{1}, *α*_{2}, and *α*_{3} are given by the first, second, and third elements of the AxesMisalignment property of `gyroparams`

.

**Bias Instability Drift**

The bias instability drift *β*_{1} is modeled as white
noise biased and then filtered:

$$\begin{array}{l}{g}_{1}{\beta}_{1}(k)=-{g}_{2}{\beta}_{1}(k-1)-{g}_{3}{\beta}_{1}(k-2)\dots -{g}_{n+1}{\beta}_{1}(k-n)\\ +{f}_{1}x(k)+{f}_{2}x(k-1)+\dots +{f}_{m+1}x(k-m)\\ x(k)=(\text{BiasInstability})w(k)\end{array}$$

where *k* is the discrete time step index, BiasInstability is
a property of `gyroparams`

,
*w* is white noise that follows a normal distribution of mean 0 and
variance of 1. The discrete time step size is the reciprocal of the SampleRate
property. [*g*_{1},
*g*_{2}, …,
*g*_{n+1}] are the
denominator coefficients specified in the
`BiasInstabilityCoefficients`

property of the `gyroparams`

object.
[*f*_{1},
*f*_{2}, …,
*f*_{m+1}] are the
numerator coefficients of the `BiasInstabilityCoefficients`

property.
*n* and *m* are the orders of the denominator and
numerator coefficients, respectively.

**White Noise Drift**

White noise drift is modeled by multiplying elements of the white noise random stream by the standard deviation:

$${\beta}_{2}=\left(w\right)\left(\sqrt{\frac{\text{SampleRate}}{s}}\right)\left(\text{NoiseDensity}\right)$$

where *w* is white noise that follows a normal
distribution of mean 0 and variance of 1, SampleRate is an
`imuSensor`

property, and NoiseDensity is an
`gyroparams`

property.
The scale variable *s* = 2 if the `NoiseType`

property of the `gyroparams`

object is
double-sided and *s* = 1 if the `NoiseType`

property is single-sided.

**Random Walk Drift**

The random walk drift is modeled by biasing elements of the white noise random stream and then filtering:

$${\beta}_{3}(k)={\beta}_{2}(k-1)+w(k)\left(\frac{\text{RandomWalk}}{\sqrt{\frac{\text{SampleRate}}{s}}}\right)$$

where *k* is the discrete time step index, RandomWalk is a
property of `gyroparams`

, SampleRate is a
property of `imuSensor`

, and *w* is white noise that
follows a normal distribution of mean 0 and variance of 1. The discrete time step size
is the reciprocal of the SampleRate
property. The scale variable *s* = 2 if the
`NoiseType`

property of the `gyroparams`

object is
double-sided and *s* = 1 if the `NoiseType`

property is single-sided.

**Environmental Drift Noise**

The environmental drift noise is modeled by multiplying the temperature difference from a standard with the temperature bias:

$${\Delta}_{e}=(\text{Temperature}-25)(\text{TemperatureBias})$$

where Temperature is a property of `imuSensor`

, and TemperatureBias is a property of `gyroparams`

. The constant 25 corresponds to a standard temperature.

**Acceleration Bias Drift**

The acceleration bias drift is modeled by multiplying the acceleration input and acceleration bias:

$${\Delta}_{a}=acceleration*\text{AccelerationBias}$$

where AccelerationBias is
a property of `gyroparams`

.

**Scale Factor Error Model**

The temperature scale factor error is modeled as:

$$scaleFactorError=1+\left(\frac{\text{Temperature}-25}{100}\right)(\text{TemperatureScaleFactor})$$

where Temperature is a property of `imuSensor`

, and TemperatureScaleFactor is a property of `gyroparams`

. The constant 25 corresponds to a standard temperature.

**Quantization Model**

The quantization is modeled by first saturating the continuous signal model:

$$e=\{\begin{array}{c}\begin{array}{c}\text{MeasurementRange}\\ -\text{MeasurementRange}\end{array}\\ d\end{array}\begin{array}{c}\\ \\ \end{array}\begin{array}{c}\text{if}\\ \text{if}\\ \text{else}\end{array}\begin{array}{c}\\ \\ \end{array}\begin{array}{c}d>\text{MeasurementRange}\\ -d>\text{MeasurementRange}\\ \end{array}$$

and then setting the resolution:

$$gyroReadings=(\text{Resolution})\left(\mathrm{round}\left(\frac{e}{\text{Resolution}}\right)\right)$$

where MeasurementRange is a property of `gyroparams`

.

### Magnetometer

The following algorithm description assumes an NED navigation frame. The magnetometer model
uses the ground-truth orientation and acceleration inputs, and the
`imuSensor`

and `magparams`

`magparams`

(Sensor Fusion and Tracking Toolbox)
properties to model magnetometer readings.

**Convert to Sensor Frame**

The ground-truth acceleration is converted from the local frame to the sensor frame using the ground-truth orientation:

$$a=\left(orientation\right){\left(totalAcc\right)}^{T}$$

If the orientation is input in quaternion form, it is converted to a rotation matrix before processing.

**Bulk Model**

The ground-truth acceleration in the sensor frame, *a*, passes through the bulk model, which adds axes misalignment and bias:

$$b={\left(\left[\begin{array}{ccc}1& \frac{{\alpha}_{2}}{100}& \frac{{\alpha}_{3}}{100}\\ \frac{{\alpha}_{1}}{100}& 1& \frac{{\alpha}_{3}}{100}\\ \frac{{\alpha}_{1}}{100}& \frac{{\alpha}_{2}}{100}& 1\end{array}\right]\left({a}^{T}\right)\right)}^{T}+\text{ConstantBias}$$

where ConstantBias is a property of `magparams`

, and *α*_{1}, *α*_{2}, and *α*_{3} are given by the first, second, and third elements of the AxesMisalignment property of `magparams`

.

**Bias Instability Drift**

The bias instability drift *β*_{1} modeled as white noise
biased and then filtered:

$$\begin{array}{l}{g}_{1}{\beta}_{1}(k)=-{g}_{2}{\beta}_{1}(k-1)-{g}_{3}{\beta}_{1}(k-2)\dots -{g}_{n+1}{\beta}_{1}(k-n)\\ +{f}_{1}x(k)+{f}_{2}x(k-1)+\dots +{f}_{m+1}x(k-m)\\ x(k)=(\text{BiasInstability})w(k)\end{array}$$

where *k* is the discrete time step index, BiasInstability is
a property of `magparams`

,
*w* is white noise that follows a normal distribution of mean 0 and
variance of 1. The discrete time step size is the reciprocal of the SampleRate
property. [*g*_{1},
*g*_{2}, …,
*g*_{n+1}] are the
denominator coefficients specified in the
`BiasInstabilityCoefficients`

property of the `magparams`

object.
[*f*_{1},
*f*_{2}, …,
*f*_{m+1}] are the
numerator coefficients of the `BiasInstabilityCoefficients`

property.
*n* and *m* are the orders of the denominator and
numerator coefficients, respectively.

**White Noise Drift**

White noise drift is modeled by multiplying elements of the white noise random stream by the standard deviation:

$${\beta}_{2}=\left(w\right)\left(\sqrt{\frac{\text{SampleRate}}{s}}\right)\left(\text{NoiseDensity}\right)$$

where *w* is white noise that follows a normal
distribution of mean 0 and variance of 1, SampleRate is an
`imuSensor`

property, and NoiseDensity is an
`magparams`

property.
The scale variable *s* = 2 if the `NoiseType`

property of the `magparams`

object is
double-sided and *s* = 1 if the `NoiseType`

property is single-sided.

**Random Walk Drift**

The random walk drift is modeled by biasing elements of the white noise random stream and then filtering:

$${\beta}_{3}(k)={\beta}_{2}(k-1)+w(k)\left(\frac{\text{RandomWalk}}{\sqrt{\frac{\text{SampleRate}}{s}}}\right)$$

where *k* is the discrete time step index, RandomWalk is a
property of `magparams`

, SampleRate is a
property of `imuSensor`

, *w* is white noise that follows
a normal distribution of mean 0 and variance of 1. The discrete time step size is the
reciprocal of the SampleRate
property. The scale variable *s* = 2 if the
`NoiseType`

property of the `magparams`

object is
double-sided and *s* = 1 if the `NoiseType`

property is single-sided.

**Environmental Drift Noise**

The environmental drift noise is modeled by multiplying the temperature difference from a standard with the temperature bias:

$${\Delta}_{e}=(\text{Temperature}-25)(\text{TemperatureBias})$$

where Temperature is a property of `imuSensor`

, and TemperatureBias is a property of `magparams`

. The constant 25 corresponds to a standard temperature.

**Scale Factor Error Model**

The temperature scale factor error is modeled as:

$$scaleFactorError=1+\left(\frac{\text{Temperature}-25}{100}\right)(\text{TemperatureScaleFactor})$$

where Temperature is a property of `imuSensor`

, and TemperatureScaleFactor is a property of `magparams`

. The constant 25 corresponds to a standard temperature.

**Quantization Model**

The quantization is modeled by first saturating the continuous signal model:

$$e=\{\begin{array}{c}\begin{array}{c}\text{MeasurementRange}\\ -\text{MeasurementRange}\end{array}\\ d\end{array}\begin{array}{c}\\ \\ \end{array}\begin{array}{c}\text{if}\\ \text{if}\\ \text{else}\end{array}\begin{array}{c}\\ \\ \end{array}\begin{array}{c}d>\text{MeasurementRange}\\ -d>\text{MeasurementRange}\\ \end{array}$$

and then setting the resolution:

$$magReadings=(\text{Resolution})\left(\mathrm{round}\left(\frac{e}{\text{Resolution}}\right)\right)$$

where MeasurementRange is a property of `magparams`

.

## Extended Capabilities

### C/C++ Code Generation

Generate C and C++ code using Simulink® Coder™.

## Version History

**Introduced in R2020a**

### R2023b: Specify bias instability noise coefficients and noise type for accelerometer, gyroscope, and magnetometer

You can use these new parameters in the **Accelerometer, Gyroscope, or
Magnetometer** tab to specify the coefficients of the transfer function used to
generate the bias instability noise and specify the scale factor of the noise
coefficients.

**Bias instability filter numerator coefficients****Bias instability filter denominator coefficients****Noise type**

## See Also

### Classes

### Objects

## Comando MATLAB

Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:

Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)