我正在开发一个应用程序,需要读取一分钟内的心跳并计算其心率变异性。
为了读取心跳,我使用了带子(Polar)。
关于计算HRV,我查看了以下链接,但没有得到任何帮助:
请提供公式,以便我可以从HR中获得HRV(RMSSD),并且持续时间为一分钟。
任何帮助都将不胜感激..
编辑:
我已经使用以下代码获取了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 =
![enter image description here](https://istack.dev59.com/OQ2TB.webp)
请帮忙解答。
编辑:
//==================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]];
}
}
}
}
NSLog(@"%@",datas)
的输出结果 - 我需要看到传感器值的原始数据。我怀疑你的解码代码不正确。你需要检查第3位,以查看是否存在能量消耗,并且每个数据包可能有多个RR值。另外,从阅读论文来看,SSDN是HRV,而不是RMSSD。还要注意,数据包中的RR值以1/1024秒为单位。 - Paulw11