資源簡(jiǎn)介
在matlab環(huán)境下,實(shí)現(xiàn)ECG信號(hào)R波的檢測(cè),方法是小波變換。
代碼片段和文件信息
clc
clear
%?read?the?ECG?singal?data?and?translate?original?binary?data?into?decimal?data?
%?picture?the?ECG?data
%?parameter?settings:?
?PATH=?‘E:\02--ECG\Database\PTBdb\patient001‘;?%?set?data?storage?path?
?HEADERFILE=?‘s0010_re.hea‘;??????%?.hea?format,header?file?
?DATAFILE=‘s0010_re.dat‘;?????????%?.dat?format,ECG?data?
%?output?parameter:M?—a?matrix?with?SAMPLES2READ?rows?and?15?columnseach?column?represents?a?channel?of?data.?
%?read?the?headfile
signalh=?fullfile(PATH?HEADERFILE);??????????????????%?through?the?function?fullfile?for?the?full?path?of?header?file?
fid1=fopen(signalh‘r‘);??????????????????????????????%?open?the?header?file?with?attribute?‘r-‘?
z=?fgetl(fid1);???????????????????????????????????????%?read?the?first?line?data?of?the?header?file,strings?format
A=?sscanf(z?‘%*s?%d?%d?%d‘[13]);???????????????????%?according?to?the?format?‘%*s?%d?%d?%d‘translate?the?data?and?store?them?into?matrix?A?‘*s‘means?ignore?the?strings?
nosig=A(1);???????????????????????????????????????????%?signal?channel?number
sfreq=A(2);???????????????????????????????????????????%?data?frequency?
allnum=A(3);??????????????????????????????????????????%?data?number???
clear?A;??????????????????????????????????????????????%?clear?matrix?A?and?prepare?to?read?the?next?line?data?
for?k=1:nosig?????????????????????????????????????????%?read?the?data?information?of?each?channel
????z=?fgetl(fid1);?
????A=?sscanf(z?‘%*s?%d?%d?%d?%d?%d‘[15]);?
????dformat(k)=?A(1);?????????????????????????????????%?signal?format?16bit?
????gain(k)=?A(2);????????????????????????????????????%?the?number?of?integer?in?each?channel
????bitres(k)=?A(3);??????????????????????????????????%?sampling?accuracy?
????zerovalue(k)=?A(4);???????????????????????????????%?ECG?zero?corresponding?integer?value
end;?
fclose(fid1);?
clear?A;?
?
%?load?binary?data???
%?.dat?format?file-datafile.dat???
%??two?Byte?represent?a?integer?m
if?dformat~=?16
????error(‘this?script?does?not?apply?binary?formats?different?to?16.‘);??
end;?
SAMPLES2READ=allnum/nosig;????????????????????????????%?samples?need?to?load??
signald=?fullfile(PATH?DATAFILE);????????????????????
fid2=fopen(signald‘r‘);??????????????????????????????%?open?the?header?file?with?attribute?‘r-‘?
M=?fread(fid2?[nosig?SAMPLES2READ]?‘int16‘)‘;??????%?load?the?data?into?the?first?columnsecond?column......
i=input(‘input?the?channel?number(1=X=0:1/sfreq:(SAMPLES2READ-1)/sfreq;
B=(M(:i)-zerovalue(i))/gain(i);?
%?filter?the?original?sianal?
%?Butterworth?filter?
%?the?frequency?response?curve?within?the?passband?maintains?maxinum?flat?
%?there?are?no?ups?and?downs?and?within?stopband?is?gradually?reduced?to?zero
%wp:Passband?cut-off?frequency(通帶阻止頻率),ws:Stopband?cut-off?frequency(阻帶截止頻率)
%rp:Passband?maximum?attenuation(通帶最大衰減),rs:Stopband?minimum?attenuation(阻帶最小衰減)?
wp=150;ws=220;rp=0.5;rs=40;Fs=sfreq;?????????????
[NWn]=buttord(wp/(Fs/2)ws/(Fs/2)rprs);
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件???????5052??2013-03-15?19:26??detect_R_Wavelet.m
-----------?---------??----------?-----??----
?????????????????5052????????????????????1
- 上一篇:基于sift算法的圖像拼接
- 下一篇:隨機(jī)子空間集成分類(lèi)器
評(píng)論
共有 條評(píng)論