单独吸气和呼气持续时间

3 views (last 30 days)
Majd Ag
Majd Ag 2020年4月12日
回答: Peter Perkins on 14 Apr 2020
大家好,
使用ni myrio,我获得了信号和阈值之间的一系列相交点,每两个值代表吸气和呼气的上升和下降。
I want to subtract each two values and store them in new arrays, inhale time, exhale time and breath time.
现在我知道我遇到的循环中存在问题,但我不知道如何修复它们,请帮助我。我得到的持续时间相同,也许 j 不更新
附加的图片是信号的值s were obtained from.
呼吸= [903,1979,2313,3550,3870,4947,5232,6517,6867,7818,8181,9512];
计数=长度(呼吸)/2;%计数峰(吸入和呼气)
%找到吸气和呼气的持续时间
笔记=零(1,count/2);
为了k=1:count/2%吸气持续时间
为了j = 1:4:长度(呼吸)-4
硬度(k)=呼吸(J+1)-Breath(J);
结尾
结尾
exduration =零(1,count/2);
为了n = 1:计数/2%呼气持续时间
为了j = 3:4:长度(呼吸)-4
Exduration(n)=呼吸(J+1)-Breath(J);
结尾
结尾
brduration =零(1,count/2);
为了r=1:count/2整个呼吸持续时间%
为了j = 1:4:长度(呼吸)-4
brduration(r)=呼吸(j+3) - 呼吸(J);
结尾
结尾
2条评论
Majd Ag
Majd Ag 2020年4月12日
谢谢您的回答,我尝试在第一个循环内显示J,并且在两个值1和5之间交替三次,这是什么意思?

登录发表评论。

答案(1)

Peter Perkins
Peter Perkins on 14 Apr 2020
您不需要任何循环。
Your picture doesn't seem to match your description, but if each sret of four values corresponds to inhale start, inhale stop, exhale start, exhale stop, then do this:
>>呼吸=秒([[903,1979,2313,3550,3870,4947,5232,6517,6867,7818,7818,8181,9512])
呼吸=
1×12个持续时间array
903秒1979秒2313秒3550秒3870 sec4947秒5232秒6517秒6867秒7818秒8181秒9512秒
>>吸气= reshape(呼吸([1 2 5 6 9 10]),[2 3])
吸气=
2×3个持续时间array
903秒3870 sec6867秒
1979秒4947秒7818秒
>>吸入= diff(吸入)
吸入=
1×3个持续时间array
1076秒1077 sec951秒
同样,对于其他人。

社区寻宝

在Matlab Central中找到宝藏,发现社区如何为您提供帮助!

Start Hunting!