我正在进行的应用程序中,我必须阅读心跳到1分钟,并从它计算心率变异性。
读心跳,我用皮带(极地)
我从链接中使用的心跳读取代码
在计算HRV时,我经历了以下链接,但没有任何帮助:
请提供公式,我可以从人力资源获得HRV(RMSSD),持续时间是1分钟。
任何帮助都将不胜感激..。
编辑:
我有以下代码的RR值:
- (void) updateWithHRMData:(NSData *)datas {
const uint8_t *reportData = [datas bytes];
uint16_t bpm = 0;
uint16_t bpm2 = 0;
if ((reportData[0] & 0x04) == 0)
{
NSLog(@"%@", @"Data are not present");
}
else
{
bpm = CFSwapInt16LittleToHost(*(uint16_t *)(&reportData[2]));
bpm2 = CFSwapInt16LittleToHost(*(uint16_t *)(&reportData[4]));
if (bpm != 0 || bpm2 != 0) {
NSLog(@"%u", bpm);
if (bpm2 != 0) {
NSLog(@"%u", bpm2);
}
}
}
}
我的问题是,我的RR值是:666,636,645.等等,但当我使用HRV +
应用程序并通过电子邮件导出RR值时,它显示的值为0.785、0.734、0.724等等。如果我用下列公式计算我的RR值:
RMSSD =
这给了我完全错误的结果。
请帮帮忙。
编辑:
//==================RR
if ((reportData[0] & 0x04) == 0)
{
NSLog(@"%@", @"Data are not present");
}
else
{
uint16_t rr2 = CFSwapInt16LittleToHost(*(uint16_t *)(&reportData[2]));
RR = CFSwapInt16LittleToHost(*(uint16_t *)(&reportData[4]));
//sometimes two values of RR may found so there are two RR: RR and rr2 which added in array and all calculation goes after one minute
if (rr2 > 0 || RR > 0) {
NSLog(@"RR2 %u", rr2);
if (rr2>0) {
[RRArray addObject:[NSNumber numberWithInt:rr2]];
}
if (RR != 0) {
NSLog(@"RR %u", RR);
[RRArray addObject:[NSNumber numberWithInt:RR]];
}
}
}
}
发布于 2014-07-08 08:38:48
您需要执行第一篇链接文章第2.2.1节中描述的统计计算。
你不能从心率计算HRV -你需要使用RR间隔。
您需要检查传感器返回的数据,以查看是否设置了标志字节的第4位--这表明存在RR数据。然后,您可以将RR数据读入数组,将16位示例数据转换为NSNumber
。您可以修改教程中的代码,将16位心跳值转换为int。
一旦你收集了足够的样本(我不确定1分钟的样本在统计上是有效的,但我不是统计学家),那么你就可以进行分析了。
THB将是数组中RR间隔的数目。
MRR或I(BAR)你可以按以下方式计算-
float rrTotal=0;
for (int i=1;i<[rrIntervals count]; i++) {
rrTotal+=[[rrIntervals objectAtIndex:i] intValue];
}
float mrr = rrTotal/([rrIntervals count]-1);
SDNN (即您的HRV)计算如下:
float sdnnTotal = 0;
for (int i=1;i<[rrIntervals count]; i++) {
sdnTotal+=pow( [[rrIntervals objectAtIndex:i] intValue] - mrr,2) ;
}
float sdnn = sqrt(sdnTotal/([rrIntervals count]-1));
在向数组中添加更多数据时,可以继续重新计算HRV。
https://stackoverflow.com/questions/24624039
复制相似问题