94
生醫訊號處理報告 PPG 組員名單 4A227001陳威丞 4A227020張奕凱 4A227034林昱佑 4A227038黃聖閔 指導老師:侯春茹

生醫訊號處理報告 PPG · PDF file生醫訊號處理報告 ppg 組員名單 4a227001陳威丞 4a227020張奕凱 4a227034林昱佑 4a227038黃聖閔 ... 數位處理 後級放大器

Embed Size (px)

Citation preview

  • PPG

    4A227001

    4A227020

    4A227034

    4A227038 :

  • PPG

    PPG

    PPG

    PPG

  • PPG

    PPG(Photoplethysmography)

  • PPG0.5Hz15Hz

    PPG

  • PPG

    : LED LED

  • PPG

    1. (1)

    2. (2)

    (1) (2)

  • PPG

    MSP430

    MATLAB

    0.5HZ

    15HZ

    CNY70

  • ppg 51020

  • :0.515Hz Fs():1024Hz

  • T=1/fs; subplot(212)

    fd=1/(N*T); plot(fy,angle(y_fft))

    m=0:N-1; title('Phase spectrum of signals')

    fy=m.*fd; xlabel('Frequency (Hz)')

    y_fft=fft(y); ylabel('phase')

    figure(2)

    subplot(211)

    plot(fy,abs(y_fft))

    title('Magnitude spectrum of signals')

    xlabel('Frequency (Hz)')

    ylabel('Magnitude')

  • (fc)

    Butterworth IIR :0.5hz :15hz

    :0.05hz :30hz

    1 60 :11 :4

    Elliptic IIR :0.5hz :15hz

    :0.05hz :30hz

    1 60 :5 :3

    Chebyshev

    I

    IIR :0.5hz :15hz

    :0.05hz :30hz

    1 60 :7 :3

    Chebyshev

    II

    IIR :0.5hz :15hz

    :0.05hz :30hz

    1 60 :7 :3

    Kaiser FIR :0.5hz :15hz

    :0.05hz :30hz

    5% 1% :153 :5080

  • clc

    clear all

    close all

    SignalPPG = csvread('ch3.csv');

    fs=1024;

    T=1/fs;

    N=length(SignalPPG);

    t=(0:N-1)/fs;

    fd=1/(N*T);

    m=0:N-1;

    fy=m.*fd;

    % SignalPPG_base=detrend(SignalPPG);

    figure(1)

    subplot(111)

    plot(t,SignalPPG_base)

    xlabel('t (sec)')

  • Butterworth

    NR=fs/2; %Nyquist rate

    [n1,Wn1]=buttord(15/NR,30/NR,1,60);%

    [b1,a1]=butter(n1,Wn1);

    butterlow=filtfilt(b1,a1,SignalPPG_base);

    [h1,f1]=freqz(b1,a1,512,fs);

    [n2,Wn2]=buttord(0.5/NR,0.05/NR,1,60);%

    [b2,a2]=butter(n2,Wn2,'high');

    butterhigh=filtfilt(b2,a2,SignalPPG_base);

    butterband=filtfilt(b2,a2,butterlow);%+

    [h2,f2]=freqz(b2,a2,512,fs);

  • figure(2)

    subplot(211)

    plot(f1(1:15),abs(h1(1:15)))

    xlabel('Frequency (Hz)')

    ylabel('H(w)')

    title('Lowpass filter 15Hz')

    subplot(212)

    plot(f2(1:15),abs(h2(1:15)))

    xlabel('Frequency (Hz)')

    ylabel('H(w)')

    title('Highpass filter 0.5Hz')

  • Butterworth(5501300) SignalPPG_butterband1300=butterband(550:1300);

    figure(3)

    plot(t(550:1300),SignalPPG_butterband1300)

    title('Signals')

    xlabel('Time (sec)')

    ylabel('Amplitude')

  • Butterworth 0

    L=2048;

    fd=1/(L*T);

    m=0:L-1;

    fy=m.*fd;

  • Butterworth SignalPPG_butterband1300_re=SignalPPG_butterband1300.*boxcar(length(Sign

    alPPG_butterband1300));

    SignalPPG_butterband1300_hann=SignalPPG_butterband1300.*hanning(length(SignalPPG_butterband1300));

    SignalPPG_butterband1300_hamm=SignalPPG_butterband1300.*hamming(length(SignalPPG_butterband1300));

    SignalPPG_butterband1300_bm=SignalPPG_butterband1300.*blackman(length(SignalPPG_butterband1300));

    SignalPPG_butterband1300_tr=SignalPPG_butterband1300.*triang(length(SignalPPG_butterband1300));

    SignalPPG_butterband1300_re_fft=fft(SignalPPG_butterband1300_re,L);

    SignalPPG_butterband1300_hann_fft=fft(SignalPPG_butterband1300_hann,L);

    SignalPPG_butterband1300_hamm_fft=fft(SignalPPG_butterband1300_hamm,L);

    SignalPPG_butterband1300_bm_fft=fft(SignalPPG_butterband1300_bm,L);

    SignalPPG_butterband1300_tr_fft=fft(SignalPPG_butterband1300_tr,L);

  • figure(10)

    subplot(521)

    plot(t(550:1300),SignalPPG_butterband1300_re)

    axis([0.5 1.5 -100 100])

    xlabel('t (sec)')

    subplot(522)

    plot(fy(1:60),abs(SignalPPG_butterband1300_re_fft(1:60)))

    axis([0 30 0 20000])

    xlabel('f (Hz)')

    subplot(523)

    plot(t(550:1300),SignalPPG_butterband1300_hann)

    axis([0.5 1.5 -100 100])

    xlabel('t (sec)')

    subplot(524)

    plot(fy(1:60),abs(SignalPPG_butterband1300_hann_fft(1:60)))

    xlabel('f (Hz)')

    axis([0 30 0 20000])

    subplot(525)

    plot(t(550:1300),SignalPPG_butterband1300_hamm)

    axis([0.5 1.5 -100 100])

    xlabel('t (sec)')

  • subplot(526)

    plot(fy(1:60),abs(SignalPPG_butterband1300_hamm_fft(1:60)))

    axis([0 30 0 20000])

    xlabel('f (Hz)')

    subplot(527)

    plot(t(550:1300),SignalPPG_butterband1300_bm)

    axis([0.5 1.5 -100 100])

    xlabel('t (sec)')

    subplot(528)

    plot(fy(1:60),abs(SignalPPG_butterband1300_bm_fft(1:60)))

    xlabel('f (Hz)')

    axis([0 30 0 20000])

    subplot(529)

    plot(t(550:1300),SignalPPG_butterband1300_tr)

    axis([0.5 1.5 -100 100])

    xlabel('t (sec)')

    subplot(5,2,10)

    plot(fy(1:60),abs(SignalPPG_butterband1300_tr_fft(1:60)))

    xlabel('f (Hz)')

    axis([0 30 0 20000])

  • elliptic [n3,Wn3]=ellipord(15/NR,30/NR,1,60) ;%

    [b3,a3]=ellip(n3,1,60,Wn3);

    elliplow=filtfilt(b3,a3,SignalPPG_base);

    [h3,f3]=freqz(b3,a3,512,fs);

    [n4,Wn4]=ellipord(0.5/NR,0.05/NR,1,60);%

    [b4,a4]=ellip(n4,1,60,Wn4,'high');

    elliphigh=filtfilt(b4,a4,SignalPPG_base);

    [h4,f4]=freqz(b4,a4,512,fs);

    ellipband=filtfilt(b4,a4,elliplow);%+

    ellipband_fft=fft(ellipband);

  • figure(2)

    subplot(211)

    plot(f3(1:15),abs(h3(1:15)))

    xlabel('Frequency (Hz)')

    ylabel('H(w)')

    title('Lowpass filter 15Hz')

    subplot(212)

    plot(f4(1:15),abs(h4(1:15)))

    xlabel('Frequency (Hz)')

    ylabel('H(w)')

    title('Highpass filter 0.5Hz')

  • elliptic(5501300) SignalPPG_ellipband1300=ellipband(550:1300);

    figure(9)

    plot(t(550:1300),SignalPPG_ellipband1300)

    title('Signals')

    xlabel('Time (sec)')

    ylabel('Amplitude')

  • Elliptic 0

    L=2048;

    SignalPPG_base1300_fft=fft(SignalPPG_base1300,L);

    fd=1/(L*T);

    m=0:L-1;

    fy=m.*fd;

  • Elliptic SignalPPG_ellipband1300_re=SignalPPG_ellipband1300.*boxcar(len

    gth(SignalPPG_ellipband1300));

    SignalPPG_ellipband1300_hann=SignalPPG_ellipband1300.*hanning(length(SignalPPG_ellipband1300));

    SignalPPG_ellipband1300_hamm=SignalPPG_ellipband1300.*hamming(length(SignalPPG_ellipband1300));

    SignalPPG_ellipband1300_bm=SignalPPG_ellipband1300.*blackman(length(SignalPPG_ellipband1300));

    SignalPPG_ellipband1300_tr=SignalPPG_ellipband1300.*triang(length(SignalPPG_ellipband1300));

    SignalPPG_ellipband1300_re_fft=fft(SignalPPG_ellipband1300_re,L);

    SignalPPG_ellipband1300_hann_fft=fft(SignalPPG_ellipband1300_hann,L);

    SignalPPG_ellipband1300_hamm_fft=fft(SignalPPG_ellipband1300_hamm,L);

    SignalPPG_ellipband1300_bm_fft=fft(SignalPPG_ellipband1300_bm,L);

    SignalPPG_ellipband1300_tr_fft=fft(SignalPPG_ellipband1300_tr,L);

  • figure(13)

    subplot(521)

    plot(t(550:1300),SignalPPG_ellipband1300_re)

    axis([0.5 1.5 -100 100])

    xlabel('t (sec)')

    subplot(522)

    plot(fy(1:60),abs(SignalPPG_ellipband1300_re_fft(1:60)))

    axis([0 30 0 20000])

    xlabel('f (Hz)')

    subplot(523)

    plot(t(550:1300),SignalPPG_ellipband1300_hann)

    axis([0.5 1.5 -100 100])

    xlabel('t (sec)')

    subplot(524)

    plot(fy(1:60),abs(SignalPPG_ellipband1300_hann_fft(1:60)))

    xlabel('f (Hz)')

    axis([0 30 0 20000])

    subplot(525)

    plot(t(550:1300),SignalPPG_ellipband1300_hamm)

    axis([0.5 1.5 -100 100])

    xlabel('t (sec)')

  • subplot(526)

    plot(fy(1:60),abs(SignalPPG_ellipband1300_hamm_fft(1:60)))

    axis([0 30 0 20000])

    xlabel('f (Hz)')

    subplot(527)

    plot(t(550:1300),SignalPPG_ellipband1300_bm)

    axis([0.5 1.5 -100 100])

    xlabel('t (sec)')

    subplot(528)

    plot(fy(1:60),abs(SignalPPG_ellipband1300_bm_fft(1:60)))

    xlabel('f (Hz)')

    axis([0 30 0 20000])

    subplot(529)

    plot(t(550:1300),SignalPPG_ellipband1300_tr)

    axis([0.5 1.5 -100 100])

    xlabel('t (sec)')

    subplot(5,2,10)

    plot(fy(1:60),abs(SignalPPG_ellipband1300_tr_fft(1:60)))

    xlabel('f (Hz)')

    axis([0 30 0 20000])

  • Chebyshev I

    NR=fs/2; %Nyquist rate

    [n1,Wn1]=cheb1ord(15/NR,30/NR,1,60);%

    [b1,a1]=cheby1(n1,1,Wn1);

    cheby1low=filtfilt(b1,a1,SignalPPG_base);

    [h1,f1]=freqz(b1,a1,512,fs);

    [n2,Wn2]=cheb1ord(0.5/NR,0.05/NR,1,60);%

    [b2,a2]=cheby1(n2,1,Wn2,'high');

    cheby1high=filtfilt(b2,a2,SignalPPG_base);

    cheby1band=filtfilt(b2,a2,cheby1low);%+

    [h2,f2]=freqz(b2,a2,512,fs);

  • figure(4)

    subplot(211)

    plot(f3(1:30),abs(h3(1:30)))

    xlabel('Frequency (Hz)')

    ylabel('H(w)')

    title('Lowpass filter 15Hz')

    subplot(212)

    plot(f4(1:30),abs(h4(1:30)))

    xlabel('Frequency (Hz)')

    ylabel('H(w)')

    title('Highpass filter 0.5Hz')

  • ChebyshevI (5501300) SignalPPG_cheby1band1300=cheby1band(550:1300);

    figure(5)

    plot(t(550:1300),SignalPPG_cheby1band1300)

    title('Signals')

    xlabel('Time (sec)')

    ylabel('Amplitud