多尺度熵python
时间: 2023-10-12 10:05:01 浏览: 187
MultiScaleEntropy:多尺度熵(SampEn)分析工具
多尺度样本熵是一种用于分析信号的复杂性和不规则性的方法。在Python中,可以使用以下代码计算多尺度样本熵:
```python
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import time
from SampEn import sampEn
def MSE(signal, max_scale: int = 20):
result = []
length = len(signal)
std = np.std(signal)
for scale in range(1, max_scale + 1):
length = int(len(signal) / scale) - 1
scale_i = signal[:len(signal):scale][:length]
for i in range(1, scale):
scale_i = scale_i + signal[i:len(signal):scale][:length]
scale_i = scale_i / scale
result.append(sampEn(scale_i, std, r=0.15))
print("scale:", scale, 'SampEn', result[-1])
return result
white_noise = pd.read_csv("white_noise.csv").loc[:, '0']
white_noise = white_noise.to_numpy()
begin = time.time()
entropy = MSE(white_noise [2 [3<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [基于Python的多尺度熵(MSE)](https://blog.csdn.net/weixin_44290152/article/details/121203587)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [python求信号的多尺度样本熵](https://blog.csdn.net/weixin_44463965/article/details/131553649)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文