IMU simulation model

**Library:**Navigation Toolbox / Multisensor Positioning / Sensor Models

Sensor Fusion and Tracking Toolbox / Multisensor Positioning / Sensor Models

The IMU
Simulink^{®} block models receiving data from an inertial measurement unit (IMU) composed of
accelerometer, gyroscope, and magnetometer sensors.

`Linear Acceleration`

— Acceleration of IMU in local navigation coordinate system
(m/sAcceleration 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)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 systemOrientation 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`

. *N* is the number of samples in the current
frame.

**Data Types: **`single`

| `double`

`Accel`

— Accelerometer measurement of IMU in sensor body coordinate system
(m/sAccelerometer 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)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)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`

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

(default) | real scalarOperating 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 scalarMagnetic 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.

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

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

.

**Data Types: **`single`

| `double`

`Seed`

— Initial seed for randomization`67`

(default) | nonnegative integerInitial 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.

`Maximum readings (m/s`^{2})

— Maximum sensor reading (m/s`inf`

(default) | real positive scalarMaximum 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`0`

(default) | real nonnegative scalarResolution 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`[0 0 0]`

(default) | real scalar | real 3-element row vectorConstant 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`[0 0 0]`

(default) | real scalar | real 3-element row vectorVelocity 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`[0 0 0]`

(default) | real scalar | real 3-element row vectorInstability 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`[0 0 0]`

(default) | real scalar | real 3-element row vectorAcceleration 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`[0 0 0]`

(default) | real scalar | real 3-element row vectorSensor 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`

`Maximum readings (rad/s)`

— Maximum sensor reading (rad/s)`inf`

(default) | real positive scalarMaximum 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 scalarResolution 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 vectorConstant 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`[0 0 0]`

(default) | real scalar | real 3-element row vectorSensor 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 vectorAcceleration 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 vectorInstability 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 vectorIntegrated 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 vectorSensor 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`

`Maximum readings (μT)`

— Maximum sensor reading (μT)`inf`

(default) | real positive scalarMaximum 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 scalarResolution 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 vectorConstant 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 vectorPower 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 vectorInstability 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 vectorIntegrated 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 vectorSensor 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`

The accelerometer model uses the ground-truth orientation and acceleration inputs and the `imuSensor`

and `accelparams`

properties to model accelerometer readings.

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}) as:

$$totalAcc=-acceleration+g$$

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.

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`

.

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+\left(\frac{2}{\text{SampleRate}}-1\right){z}^{-1}}$$

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.

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}}$$

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.

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.

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`

.

The gyroscope model uses the ground-truth orientation, acceleration, and angular velocity inputs, and the `imuSensor`

and `gyroparams`

properties to model accelerometer readings.

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.

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`

.

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+\left(\frac{2}{\text{SampleRate}}-1\right){z}^{-1}}$$

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.

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}}$$

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.

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.

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`

.

The magnetometer model uses the ground-truth orientation and acceleration inputs, and the `imuSensor`

and `magparams`

properties to model magnetometer readings.

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.

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`

.

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+\left(\frac{2}{\text{SampleRate}}-1\right){z}^{-1}}$$

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.

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}}$$

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.

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.

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`

.

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

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

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

Select web siteYou can also select a web site from the following list:

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

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

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