%% Generate Noisy Altimeter Readings from Stationary Input
% Create an altimeterSensor System object™ to model receiving altimeter sensor data. Assume a typical one Hz sample rate and a 10 minute simulation time. Set ConstantBias to 0.01, NoiseDensity to 0.05, BiasInstability to 0.05, and DecayFactor to 0.5.

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

%
% Call 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')

%
% Copyright 2018 The MathWorks, Inc.
%