1 简介
提取心电信号PTT+HRV+PRV
2 部分代码
clc;clear all;close all;x=load('day2_0917.txt');%% ECG signaly=x(1:95000,1); % ECG signalfigure,plot(y);title('ECG signal');xlabel('time');ylabel('amplitude');hold on%% PPG signalz=x(200:95000,2); % PPG signalplot(z,'r');title('PPG signal');xlabel('time');ylabel('amplitude');%% peak detection of ECGj=1;n=length(y);for i=2:n-1if y(i)> y(i-1) && y(i)>= y(i+1) && y(i)> 0.45*max(y)val(j)= y(i);pos(j)=i;j=j+1;endendecg_peaks=j-1;ecg_pos=pos./1000;plot(pos,val,'*r');title('ECG peak');%% peak detection of PPGm=1;n=length(z);for i=2:n-1if z(i)> z(i-1) && z(i)>= z(i+1) && z(i)> 0.45*max(z)val(m)= z(i);pos1(m)=i;m=m+1;endendppg_peaks=m-1;ppg_pos=pos1./1000;ppg_val=val;plot(pos1,val,'*g');title('ECG & PPG signal');legend('ECG signal','PPG signal');%% HRVj=1;for i=1:ecg_peaks-1e(j)= ecg_pos(i+1)-ecg_pos(i);% gives RR intervalj=j+1;endhr=60./mean(e); % 60/ mean of RR intervalhrv= (60./e); % 60/ each RR intervalfigure,stairs(hrv);title('HRV');xlabel('samples');ylabel('hrv');%% PRVk=1;for i=1:ppg_peaks-1f(k)= ppg_pos(i+1)-ppg_pos(i);k=k+1;endpr=60./mean(f);prv= 60./f;figure,stairs(prv);title('PRV');xlabel('samples');ylabel('prv');%% PTTptt=(ppg_pos-ecg_pos);figure,stairs(ptt);title('PTT');xlabel('ptt');ylabel('time');%% notch detection%%moving average filterav=smooth(z,150);%%differentiationp=100*diff(av,1); % (signal,order of differentiation), 100 to amplify the signal%%finding peak of the notch on the differentiated signalnp=1; % notch peakm=length(p);for i=2:m-1if p(i)> p(i-1) && p(i)>= p(i+1)val(np)= p(i);pos(np)=i;np=np+1;endendu=1;for j=1:2:length(pos)notch_pos(u)=pos(j);notch_val(u)=val(j);u=u+1;endn_val=z(notch_pos);%% reflection index = b/a *100%b=diff between notch and peak in y axis%a=ppg peak value in y axisnv=n_val(2,:)';ri=((ppg_val-nv)./ppg_val)*100;ref_index=mean(ri)%% stiffness index = h/ptt;h=0.60;%h is the length from subject's finger tip to heartsi=(h./ptt);stif_index=mean(si)
3 仿真结果



4 参考文献
[1]林金朝, 李必禄, 李国权,等. 基于EWT和结构特征提取的心电信号R波识别算法[J]. 电子学报, 2021, 49(6):7.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
1123

被折叠的 条评论
为什么被折叠?



