%% Find Approximate Entropy of Data
% In this example, consider the position data of a quadcopter, following a circular path. The file uavPositionData.mat contains the x, y and z-direction position data traversed by the copter.
% Load the data set and visualize the quadcopter path in 3D.

load('uavPositionData.mat','xv','yv','zv');
plot3(xv,yv,zv);

%
% For this example, use only x-direction position data for computation. Since Lag is unknown, estimate the delay using phaseSpaceReconstruction. Set 'Dimension' to 3. The Dimension and Lag parameters are required to compute the approximate entropy of the data.

dim = 3;
[~,lag] = phaseSpaceReconstruction(xv,[],dim)

%
% Find the approximate entropy using the Lag value obtained in the previous step.

approxEnt = approximateEntropy(xv,lag,dim)

% Since the quadcopter is traversing a pre-defined circular trajectory of fixed radius, the position data is regular and hence, the value of approximate entropy is low.
% Copyright 2018 The MathWorks, Inc.