This function calculates fluctuation-based dispersion entropy (FDispEn) of a univariate
时间: 2024-10-19 17:04:23 浏览: 28
The "fluctuation-based dispersion entropy" or FDispEn is a measure of the complexity and disorder in a univariate time series or signal. It's often used in the field of physics, information theory, and data analysis to quantify how much the values in the series deviate from their mean, which can provide insights into the irregularity or unpredictability of the system that generated the data.
The calculation of FDispEn typically involves several steps:
1. **Mean Calculation**: Compute the average value of the data.
2. **Fluctuation Calculation**: Subtract the mean from each data point to get the fluctuations (deviations).
3. **Square the Fluctuations**: Square the resulting deviations to emphasize the impact of larger discrepancies.
4. **Normalization**: Divide each squared deviation by the total sum of squares to normalize the result between 0 and 1.
5. **Entropy Calculation**: Use the Shannon entropy formula, where entropy is proportional to the negative sum of the square fluctuations times their probabilities. In this case, the probability is the frequency or relative occurrence of each deviation.
Here's a simplified version of a MATLAB code snippet to calculate FDispEn for a given vector `x`:
```matlab
function fdispEn = compute_FDispEn(x)
% Step 1: Calculate mean
mean_val = mean(x);
% Step 2: Calculate fluctuations
fluctuations = x - mean_val;
% Step 3: Square the fluctuations
squared_fluctuations = fluctuations.^2;
% Step 4: Normalize (calculate probabilities)
norm_squares = squared_fluctuations / sum(squared_fluctuations);
% Step 5: Compute entropy (using base 2 for simplicity)
prob_sum = sum(norm_squares);
if prob_sum == 0
warning('All data points are identical, FDispEn is undefined');
else
fdispEn = -sum(norm_squares .* log2(norm_squares)) / log2(prob_sum); % Note: log2 is not included in base 'e' MATLAB logs by default
end
end
```
阅读全文