# IMU

IMU simulation model

**Library:**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.

## 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.

**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.

**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`

### 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).

`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.

**Data Types: **`single`

| `double`

`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`

.

**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`

.

**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 (%)

`[0 0 0]`

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

Sensor axes skew in a percentage, specified as a real scalar or 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`

`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`

`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`

`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 (%)

`[0 0 0]`

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

Sensor axes skew in a percentage, specified as a real scalar or 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`

`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))`

— Acceleration random walk ((rad/s)/(√Hz))

`[0 0 0]`

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

Acceleration 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`

`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 (%)

`[0 0 0]`

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

Sensor axes skew in a percentage, specified as a real scalar or 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`

`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`

`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`

## Model Examples

## 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 is modeled as white noise biased and then filtered:

$${\beta}_{1}={h}_{1}*(w)(\text{BiasInstability})$$

where BiasInstability is a property of `accelparams`

, and *h*_{1} is a filter defined by the SampleRate property:

$${H}_{1}\left(z\right)=\frac{1}{1-\frac{1}{2}{z}^{-1}}$$

**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}}{2}}\right)\left(\text{NoiseDensity}\right)$$

where SampleRate is an `imuSensor`

property, and NoiseDensity is an `accelparams`

property. Elements of *w* are random numbers given by settings of the `imuSensor`

random stream.

**Random Walk Drift**

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

$${\beta}_{3}={h}_{2}*(w)\left(\frac{\text{RandomWalk}}{\sqrt{\frac{\text{SampleRate}}{2}}}\right)$$

where RandomWalk is a property of `accelparams`

, SampleRate is a property of `imuSensor`

, and *h*_{2} is a filter defined as:

$${H}_{2}\left(z\right)=\frac{1}{1-{z}^{-1}}$$

**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 is modeled as white noise biased and then filtered:

$${\beta}_{1}={h}_{1}*(w)(\text{BiasInstability})$$

where BiasInstability is a property of `gyroparams`

and *h*_{1} is a filter defined by the SampleRate property:

$${H}_{1}\left(z\right)=\frac{1}{1-\frac{1}{2}{z}^{-1}}$$

**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}}{2}}\right)\left(\text{NoiseDensity}\right)$$

where SampleRate is an `imuSensor`

property, and NoiseDensity is an `gyroparams`

property. The elements of *w* are random numbers given by settings of the `imuSensor`

random stream.

**Random Walk Drift**

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

$${\beta}_{3}={h}_{2}*(w)\left(\frac{\text{RandomWalk}}{\sqrt{\frac{\text{SampleRate}}{2}}}\right)$$

where RandomWalk is a property of `gyroparams`

, SampleRate is a property of `imuSensor`

, and *h*_{2} is a filter defined as:

$${H}_{2}\left(z\right)=\frac{1}{1-{z}^{-1}}$$

**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.

**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`

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 is modeled as white noise biased and then filtered:

$${\beta}_{1}={h}_{1}*(w)(\text{BiasInstability})$$

where BiasInstability is a property of `magparams`

and *h*_{1} is a filter defined by the SampleRate property:

$${H}_{1}\left(z\right)=\frac{1}{1-\frac{1}{2}{z}^{-1}}$$

**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}}{2}}\right)\left(\text{NoiseDensity}\right)$$

where SampleRate is an `imuSensor`

property, and NoiseDensity is an `magparams`

property. The elements of *w* are random numbers given by settings of the `imuSensor`

random stream.

**Random Walk Drift**

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

$${\beta}_{3}={h}_{2}*(w)\left(\frac{\text{RandomWalk}}{\sqrt{\frac{\text{SampleRate}}{2}}}\right)$$

where RandomWalk is a property of `magparams`

, SampleRate is a property of `imuSensor`

, and *h*_{2} is a filter defined as:

$${H}_{2}\left(z\right)=\frac{1}{1-{z}^{-1}}$$

**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**

## MATLAB 명령

다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.

명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 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)