How does the approximate entropy function work for a multivariate signal?
10 views (last 30 days)
Show older comments
I am curious about the use of the approximate entropy function in Matlab. I have 838 points that move in three dimensions at equally spaced time intervals, and so far when I input the X,Y,Z coords of these points into the function it gives me an entropy value for each point. This is exactly what I want, but I don't understand how this is being calculated. I see that the the distance between points is being calculated in the formula, so this must have something to do with it? I want to compare my results to Sample Entropy, but the function I see online for SampEn only takes in a 1 dimensional vector.
2 Comments
the cyclist
on 14 Nov 2023
Can you upload the data and your code? You can use the paper clip icon in the INSERT section of the toolbar.
Accepted Answer
Pratyush
on 22 Dec 2023
Hi Adam,
I understand that you want to know how Approximate Entropy is calculated and how to compare it with Sample Entropy.
Approximate Entropy (ApEn) and Sample Entropy (SampEn) are measures used to quantify the unpredictability and complexity of time-series data. ApEn can be used for multidimensional data like your 3D coordinates by reconstructing a phase space trajectory and calculating the similarity between different states of this trajectory.
Here's a general idea on how ApEn is calculated:
- Reconstruct the phase space using the embedding dimension `m` and time delay `τ`.
- Compute the Chebyshev distance between states in the phase space.
- Set a threshold `r` to determine the similarity between states.
- Count the number of similar states for each state.
- Calculate the logarithmic frequency of similar states.
- Average these logarithms and subtract the average for `m+1` from that for `m` to get ApEn.
You can refer to the documentation for the algorithm: https://in.mathworks.com/help/predmaint/ref/approximateentropy.html#d126e1251
For SampEn, which is typically used for 1D data and does not count self-matches, you can convert your 3D data into a 1D series (e.g., by calculating the magnitude of the vectors) and then apply SampEn to this 1D series. You'll need to define the embedding dimension `m` and a threshold `r`, often a proportion of the standard deviation of your 1D data.
Here's a basic example of how you might convert 3D data to 1D for SampEn analysis in MATLAB:
% Assuming X, Y, Z are column vectors of equal length representing the coordinates
magnitude = sqrt(X.^2 + Y.^2 + Z.^2); % Convert to 1D magnitude time series
% Define parameters for SampEn
m = 2; % Embedding dimension
r = 0.2 * std(magnitude); % Tolerance (often a proportion of the standard deviation)
% Calculate Sample Entropy
sampen_value = sampen(magnitude, m, r);
Hope this helps.
More Answers (0)
See Also
Categories
Find more on Get Started with Signal Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!