rmssd.m
来自「matlab下实现kaplan算法」· M 代码 · 共 41 行
M
41 行
function [t,v,lab]=rmssd(times, vals, labels);% function[t,v,labs]=rmssd(times, vals, labels);% calculates the rmssd: the square root of the mean % of the sum of the squares of the% differences.% standard format.% the label returned is the fraction of bogus beat pairs in the sample.% the t returned is the [min,max] of the time range in the data% the v returned is the value for the statistic.if nargin == 0 t = 2; % return the max and min in the segment v = 1; % return the rmssd % contents of the labels --- NOTE ALL MUST BE THE SAME LENGTH lab = [ 't1=min time '; 't2=max time '; 'v1=rmssd '; 'lb=frac bad beats']; return;endleng = length(vals);%Make labels a column vector%labels = labels(:);% create a matrix of labelsrrlabs = [labels(1:(leng-1)),labels(2:leng)];% find which pairs have both beats validkeepers = ~(any((~(rrlabs')))');dif = diff(vals);%keep the ones where both beats are gooddif = dif( find(keepers==1) );v=sqrt(mean(dif.*dif));t=[min(times),max(times)];% label is the fraction of bad beatslab = 1-(sum(keepers)/length(keepers));
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?