Upload
tatum
View
451
Download
3
Embed Size (px)
DESCRIPTION
生醫訊號處理概論 光體積變化描記圖 (PPG). 組長 : 王宥程 組員 : 石正邦 曾志翔 李育賢. 大綱. PPG 訊號之簡介 PPG 訊號測量的方法 PPG 訊號處理的目的 PPG 訊號處理的流程 PPG 訊號處理的方法 PPG 訊號處理的結果 結論 心得. PPG 訊號之簡介. - PowerPoint PPT Presentation
Citation preview
(PPG)
: :
PPGPPGPPGPPGPPGPPG
PPG(PhotoplethysmographyPPG)PPG PPG(pulse)
PPG
PPGsensor
PPGPPG:() :0~30HZfs():1024Hz
U (UP Stroke) P (percussion wave) T (tidal wave) V (valley)D (dicrotic wave)
PPG
PPGMATLABclcclear allclose all signalPPG = csvread('ch3.csv'); fs=1024; N2=length(signalPPG);t = (1:N2)/fs; figure(1)plot(t,signalPPG)xlabel('Time (sec)');ylabel('Amplitude')title('Original Signal')xlim([-inf inf]);
PPG
fs=1024;signalPPG_detrend = detrend(signalPPG)N2=length(signalPPG_detrend);tc = (1:N2)/fs;T=1/fs;fd=1/(N2*T);m=0:N2-1;fy=m.*fd;fy_1=fy(1:(length(fy)/2));
- FFTy_fft=fft(signalPPG_detrend);%figure (2)subplot(211)plot(fy,abs(y_fft))title ('Magnitude spectrum of signals')xlabel('Frepuency(hz)')ylabel('Magnitude')%subplot(212)plot(fy,angle(y_fft))title('Phase spectrum of signals')xlabel('Frepuency(hz)')ylabel('phase')
(window)hamming window
PPG_detrend2 = length(signalPPG_detrend)PPG_hamming1 = hamming(PPG_detrend2)PPG_hamming2 = signalPPG_detrend.*(PPG_hamming1)figure (5)subplot(211)plot(PPG_hamming1)subplot(212)plot(PPG_hamming2)figure (6)freqz(PPG_hamming2,1,1024)
hamming window
hanning window
PPG_detrend3 = length(signalPPG_detrend)PPG_hanning1 = hann(PPG_detrend3)PPG_hanning2 = signalPPG_detrend.*(PPG_hanning1)figure (7)subplot(211)plot(abs(PPG_hanning1))subplot(212)plot(PPG_hanning2)figure (8)freqz(PPG_hanning2,1,1024)
hanning window
blackman window PPG_detrend4 = length(signalPPG_detrend)PPG_blackmanharris1 = blackmanharris(PPG_detrend4)PPG_blackmanharris2 = signalPPG_detrend.*(PPG_blackmanharris1)figure (9)subplot(211)plot(abs(PPG_blackmanharris1))subplot(212)plot(PPG_blackmanharris2)figure (10)freqz(PPG_blackmanharris2,1,1024)
blackman window
triangular windowPPG_detrend5 = length(signalPPG_detrend)PPG_triangular1 = triang(PPG_detrend5)PPG_triangular2 = signalPPG_detrend.*(PPG_triangular1)figure (11)subplot(211)plot(abs(PPG_triangular1))subplot(212)plot(PPG_triangular2)figure (12)freqz(PPG_triangular2,1,1024)
triangular window
60HzFFT
60Hzfs=1024;N2=length(signalPPG);tc = (1:N2)/fs;signalPPGe=signalPPG+sin(2*pi*60+tc)';
fs=1024;signalPPG_detrend = detrend(signalPPGe) N2=length(signalPPG_detrend);tc = (1:N2)/fs;T=1/fs;fd=1/(N2*T);m=0:N2-1;fy=m.*fd;fy_1=fy(1:(length(fy)/2));
[n,Wn]=buttord(30/(fs/2),60/(fs/2),1,60)[n1,Wn1]=buttord([1 30]./(fs/2),[0.5 55]./(fs/2),1,10) [n2,Wn2]=buttord(1/(fs/2),0.1/(fs/2),1,60)
[b1,a1]=butter(n,Wn);[b2,a2]=butter(n1,Wn1);[b3,a3]=butter(n2,Wn2,'high');
yt1=filtfilt(b1,a1,signalPPG_detrend); yt2=filtfilt(b2,a2,signalPPG_detrend);yt3=filtfilt(b3,a3,yt1);
rectangular window +FFT
hamming window + FFT
hanning window + FFT
blackman window + FFT
triangular window + FFT
Cheby1sev I [n,Wn]=cheb1ord(30/(fs/2),60/(fs/2),1,60) [n1,Wn1]=cheb1ord([1 30]./(fs/2),[0.5 55]./(fs/2),1,10) [n2,Wn2]=cheb1ord(1/(fs/2),0.1/(fs/2),1,60)
[b1,a1]=cheby1(n,1,Wn);[b2,a2]=cheby1(n1,1,Wn1);[b3,a3]=cheby1(n2,1,Wn2,'high');
yci1=filtfilt(b1,a1,signalPPG_detrend); yci2=filtfilt(b2,a2,signalPPG_detrend);yci3=filtfilt(b3,a3,yci1);
rectangular window +FFT
hamming window + FFT
hanning window + FFT
blackman window + FFT
triangular window + FFT
Cheby1sev II [n,Wn]=cheb2ord(30/(fs/2),60/(fs/2),1,60) [n1,Wn1]=cheb2ord([1 30]./(fs/2),[0.5 55]./(fs/2),1,10) [n2,Wn2]=cheb2ord(1/(fs/2),0.1/(fs/2),1,60)
[b1,a1]=cheby2(n,60,Wn);[b2,a2]=cheby2(n1,60,Wn1);[b3,a3]=cheby2(n2,60,Wn2,'high');
ycii1=filtfilt(b1,a1,signalPPG_detrend); ycii2=filtfilt(b2,a2,signalPPG_detrend);ycii3=filtfilt(b3,a3,ycii1);
rectangular window +FFT
hamming window + FFT
hanning window + FFT
blackman window + FFT
triangular window + FFT
Elliptic [n,Wn]=ellipord(30/(fs/2),60/(fs/2),1,60)[n1,Wn1]=ellipord([1 30]./(fs/2),[0.5 55]./(fs/2),1,10) [n2,Wn2]=ellipord(1/(fs/2),0.1/(fs/2),1,60)
[b1,a1]=ellip(n,1,60,Wn);[b2,a2]=ellip(n1,1,60,Wn1);[b3,a3]=ellip(n2,1,60,Wn2,'high');
ye1=filtfilt(b1,a1,signalPPG_detrend); ye2=filtfilt(b2,a2,signalPPG_detrend);ye3=filtfilt(b3,a3,ye1);
rectangular window +FFT
hamming window + FFT
hanning window + FFT
blackman window + FFT
triangular window + FFT
Cheby1sev I
Cheby1sev II
Elliptic
x = filter_M(1024:2048)';y = signalPPG_detrend(1024:2048)';figure(1)subplot(211)plot(x)title('')subplot(212)plot(y)title(')
Cross-correlationyy = [y,y,y,y,y,y,y,y,y,y];N = length(yy);rxy = xcorr(yy,x);rxy = rxy(N:(2*N-1))/max(rxy);figure(2)subplot(321)plot(x)title('PPG Template')subplot(312)plot(yy)title('PPG Signal')subplot(313)plot(rxy)title('Cross-Correlation Coefficient')
L = [ ];for i =1:2000:length(rxy)-2000 rxy1 = rxy(i:i+1900); L1 = find(rxy1==max(rxy1)); L = [L,L1+1];endneeg = [];for j = 1:length(L) neeg1 = yy(L(j):(L(j)+1900)); neeg = [neeg;neeg1];end
aver = mean(neeg);figure(3)subplot(211)plot(neeg(1,:))title('One sample of PPG with noise')subplot(212)plot(aver)title('Average 10 PPG samples')figure(4)plot(neeg')
M
PSDxx = xcorr(signalPPG_detrend,signalPPG_detrend);N = length(signalPPG_detrend);xx1 = xx(N:(2*N-1));M = 1024;%indirect method xf1 = fft(xx1,M);xpsd1 = abs(xf1(1:M/2)); %direct method xf2 = fft(x,M);xpsd2 = abs(xf2(1:M/2)).^2;f = 2.*(0:M/2-1)/M;
figure(36)subplot(411)plot(signalPPG_detrend)xlabel('n'),ylabel('x(n)')title('Detrending')subplot(412)plot(xx)xlabel('m'),ylabel('R(m)')title('Autocorrelation sequence')subplot(413)plot(f,xpsd1)
xlabel('f/fs'),ylabel('Magnitude')title('Power Spectral Density')subplot(414)plot(f,xpsd2)xlabel('f/fs'),ylabel('Magnitude')title('Power Spectral Density')
PSD
PSD(SNR)figure(37)subplot(211)periodogram(yt2,rectwin(length(yt2)),256,fs);subplot(212)periodogram(yt2,rectwin(length(yt2)),1024,fs);figure(38)subplot(211)periodogram(yt2,hamming(length(yt2)),256,fs);subplot(212)periodogram(yt2,hamming(length(yt2)),1024,fs);figure(39)
subplot(211)periodogram(yt2,hanning(length(yt2)),256,fs);subplot(212)periodogram(yt2,hanning(length(yt2)),1024,fs);figure(40)subplot(211)periodogram(yt2,bartlett(length(yt2)),256,fs);subplot(212)periodogram(yt2,bartlett(length(yt2)),1024,fs);figure(41)subplot(211)
periodogram(yt2,blackman(length(yt2)),256,fs);subplot(212)periodogram(yt2,blackman(length(yt2)),1024,fs);
PSD (rectwin)
PSD (hamming)
PSD (hanning)
PSD (bartlett)
PSD (blackman)
Welchfigure(42)pwelch(yt2,rectwin(length(yt2)),256,fs);figure(43)pwelch(yt2,hamming(length(yt2)),256,fs);figure(44)pwelch(yt2,hanning(length(yt2)),256,fs);figure(45)pwelch(yt2,bartlett(length(yt2)),256,fs);figure(46)pwelch(yt2,blackman(length(yt2)),256,fs);
Welch(rectwin)
Welch(hamming)
Welch(hanning)
Welch(bartlett)
Welch(blackman)
()
60Hz
Cheby1sev I Cheby1seII EllipticFFT
()Cheby1sev I Cheby1seII Elliptic
PPG
MPSDWelchYule-Walker AR
(60HZ)
MM=10M=50PPGM=100200
,256HZ1024HZ,256HZ1024HZ