Altimeter simulation model
System object™ models receiving data from an altimeter sensor.
To model an altimeter:
altimeterSensorobject and set its properties.
Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
altimeter = altimeterSensor
System object that simulates altimeter readings.
altimeter = altimeterSensor(
System object that simulates altimeter readings relative to the reference frame
'ENU' (East-North-Up). The default value is
sets each property
altimeter = altimeterSensor(___,Name,Value)
Name to the specified
Unspecified properties have default values.
Unless otherwise indicated, properties are nontunable, which means you cannot change their
values after calling the object. Objects lock when you call them, and the
release function unlocks them.
If a property is tunable, you can change its value at any time.
For more information on changing property values, see System Design in MATLAB Using System Objects.
SampleRate — Update rate of sensor (Hz)
1 (default) | positive scalar
Update rate of sensor in Hz, specified as a positive scalar.
ConstantBias — Constant offset bias (m)
0 (default) | scalar
Constant offset bias in meters, specified as a scalar.
NoiseDensity — Power spectral density of sensor noise (m/√Hz)
0 (default) | nonnegative scalar
Power spectral density of sensor noise in m/√Hz, specified as a nonnegative scalar.
BiasInstability — Instability of bias offset (m)
0 (default) | nonnegative scalar
Instability of the bias offset in meters, specified as a nonnegative scalar.
DecayFactor — Bias instability noise decay factor
0 (default) | scalar in the range [0,1]
Bias instability noise decay factor, specified as a scalar in the range [0,1]. A
decay factor of
0 models the bias instability noise as a white noise
process. A decay factor of
1 models the bias instability noise as a
random walk process.
RandomStream — Random number source
'Global stream' (default) |
'mt19937ar with seed'
Random number source, specified as a character vector or string:
'Global stream'–– Random numbers are generated using the current global random number stream.
'mt19937ar with seed'–– Random numbers are generated using the mt19937ar algorithm with the seed specified by the
Seed — Initial seed
67 (default) | nonnegative integer scalar
Initial seed of an mt19937ar random number generator algorithm, specified as a nonnegative integer scalar.
To enable this property, set
'mt19937ar with seed'.
generates an altimeter sensor altitude reading from the
altimeterReadings = altimeter(
position — Position of sensor in local navigation coordinate system (m)
Position of sensor in the local navigation coordinate system, specified as an N-by-3 matrix with elements measured in meters. N is the number of samples in the current frame.
altimeterReadings — Altitude of sensor relative to local navigation coordinate system (m)
N-element column vector
Altitude of sensor relative to the local navigation coordinate system in meters, returned as an N-element column vector. N is the number of samples in the current frame.
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named
Generate Noisy Altimeter Readings from Stationary Input
altimeterSensor System object™ to model receiving altimeter sensor data. Assume a typical one Hz sample rate and a 10 minute simulation time. Set
Fs = 1; duration = 60*10; numSamples = duration*Fs; altimeter = altimeterSensor('SampleRate',Fs, ... 'ConstantBias',0.01, ... 'NoiseDensity',0.05, ... 'BiasInstability',0.05, ... 'DecayFactor',0.5); truePosition = zeros(numSamples,3);
altimeter with the specified
truePosition to model noisy altimeter readings from a stationary platform.
altimeterReadings = altimeter(truePosition);
Plot the true position and the altimeter sensor readings for height.
t = (0:(numSamples-1))/Fs; plot(t,altimeterReadings) hold on plot(t,truePosition(:,3),'LineWidth',2) hold off title('Altimeter Readings') xlabel('Time (s)') ylabel('Height (m)') legend('Altimeter Readings','Ground Truth')
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
See System Objects in MATLAB Code Generation (MATLAB Coder).
Introduced in R2019a