%% Estimate Approximate Entropy in the Live Editor
% Use the Estimate Approximate Entropy task in the Live Editor to interactively estimate the approximate entropy of a uniformly sampled signal. Experiment with different values for lag, embedding dimension and radius. The task automatically generates code reflecting your selections. Open this example to see a preconfigured script containing the Estimate Approximate Entropy task.
% For this example, consider 'approxEntData.mat' which contains uniformly sampled signal X, embedding dimension dim, and the time delay lag.

load('approxEntData.mat','X','dim','lag')

% To approximate entropy of the signal X, open the Estimate Approximate Entropy task in the Live Editor. On the Live Editor tab, select Task > Estimate Approximate Entropy. In the task, select signal X.
%
% Select dim for the Embedding Dimension and lag for the Time Lag dropdown menu respectively. If you do not know the embedding dimension and the time lag for your signal, use the Reconstruct Phase Space task to compute the values.
%
% Evaluate whether the value of approximate entropy is affected drastically by changing the Radius field and observe the change in value in the Live Editor output. You can toggle displaying the output of the approximate entropy value in the Live Editor output using the Output Display option.
%
% The task generates code in your live script. The generated code reflects the parameters and options you specify. To see the generated code, click  at the bottom of the task parameter area. The task expands to display the generated code.
%
% By default, the generated code uses approxEnt as the name of the output variable. To specify a different output variable name, enter a new name in the summary line at the top of the task. For instance, change the name to aEntropy.
%
% The task updates the generated code to reflect the new variable name, and the new variable aEntropy appears in the MATLAB workspace.
% Copyright 2019 The MathWorks, Inc.