✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
目前的代码是一个 Matlab 函数,它使用逐帧方法和一个名为“条件局部峰值速率”(CLPR)的新信号特征实现了一种新的基于时域的信号变化检测方法 - 局部信号的速率通过某个预定义的阈值水平高于其邻居的峰值。所提出特征的基本单位是“每个样本的局部峰”(lpps)。为了阐明函数的用法,给出了几个真实世界的例子。它们表明 CLPR 可以作为数据中各种异常或事件的良好检测程序。这些例子表明,在大多数情况下,CLPR 优于经典的变化检测方法——短时能量、短时过零率和短时峰度。
⛄ 部分代码
% Input:
% x - signal in the time domain; x could be vector or
% matrix with time across columns and indexes across rows
% threshold - threshold level along which the crossing rate is measured
%
% Output:
% cr - threshold-crossing rate of the signal, crossings per sample
function cr = crossrate(x, threshold)
% input validation
validateattributes(x, {'single', 'double'}, ...
{'2d', 'real', 'nonnan', 'nonempty', 'finite'}, ...
'', 'x', 1)
validateattributes(threshold, {'single', 'double'}, ...
{'scalar', 'real', 'nonnan', 'nonempty', 'finite'}, ...
'', 'threshold', 2)
% check if x is vector and if it is
% represent it as a column-vector
if isvector(x), x = x(:); end
% calculate the threshold-crossing rate
cr = sum(abs(diff(x > threshold)))/size(x, 1);
end
⛄ 运行结果
⛄ 参考文献
[1] H. Zhivomirov, N. Kostov. A Method for Signal Change Detection via Short-Time Conditional Local Peaks Rate Feature. Journal of Electrical and Electronics Engineering, ISSN: 1844-6035, Vol. 15, No. 2, Oct. 2022, pp. 106-109, 2022.