信号包络谱熵matlab代码
以下是一份信号包络谱熵的Matlab代码,供参考:
% 信号包络谱熵计算v
% 输入参数:
西安软件培训机构
% - signal: 输入信号
% - fs: 采样率
clamber % - win_size: 窗口大小(以采样点数为单位)
% - overlap: 窗口重叠率(以0~1之间的小数表示)
% 输出参数:
theoneandonly
% - h: 信号包络谱熵
addictive function h = env_spec_ent(signal, fs, win_size, overlap)
% 将信号分成若干个窗口fubu
win = hamming(win_size);
n = length(signal);
n_overlap = round(overlap * win_size);
给领导送礼的技巧及说话技巧 n_step = win_size - n_overlap;
n_win = floor((n - win_size) / n_step) + 1;
frames = zeros(n_win, win_size);
for i = 1:n_win
idx = (i-1)*n_step + (1:win_size);
frames(i,:) = signal(idx) .* win';
end
% 计算每个窗口的包络谱yellowbook
env_spec = zeros(n_win, win_size/2+1);
for i = 1:n_win
X = abs(fft(frames(i,:)));
X = X(1:win_size/2+1);
spec_env = smooth(X, 20);
env_spec(i,:) = spec_env;
end
% 计算每个窗口的信号包络谱熵
h = zeros(1, n_win);
for i = 1:n_win
P = env_spec(i,:) / sum(env_spec(i,:));
h(i) = -sum(P .* log2(P));
end浑家是什么意思
timeout
% 取平均值作为最终的信号包络谱熵
h = mean(h);
end。