资源简介
在matlab环境下,实现ECG信号R波的检测,方法是小波变换。
代码片段和文件信息
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);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5052 2013-03-15 19:26 detect_R_Wavelet.m
----------- --------- ---------- ----- ----
5052 1
- 上一篇:基于sift算法的图像拼接
- 下一篇:随机子空间集成分类器
相关资源
- 基于Matlab的最大熵模糊图像复原算法
- KITTI雷达点云与图像数据融合matlab源码
- matlab 解码 NMEA0183格式GGA数据
- 一个有关飞机的模板匹配的跟踪的m
- 基于MATLAB的电弧模型仿真
- PRI信号分选
- Matlab论文:基于Matlab的二进制数字调
- 802.11协议吞吐量随节点数性能仿真
- matlab图片rgb转yuv,存.yuv文件 播放器
- Duda模式分类Pattern Classification MATLAB 代
- dijkstra算法的matlab实现31274
- 随机路径生成函数matlab
- matlab语音信号处理工具箱
- matlab2013激活文件
- matlab实现游程编码
- 暗通道先验+引导滤波MATLAB代码
- 边缘检测中的canny算法及其matlab实现
- 通过达曼光栅生成点阵的matlab程序.
- MATLAB核函数算法
- 求控制系统的性能指标MptrtsFAI,matl
- matlab 求DTFT
- 逆变器重复控制算法MATLAB仿真
- MATLAB R2014b 许可协议文件
- matlab读取comtrade格式的程序
- 基于Matlab的RC一阶电路仿真
- Las点云数据读取代码
- 雷达回波加天线方向图模拟程序
- MATLAB 2017b 安装文件及其破解文件百度
- Matlab实现音频降噪
- matlab实现导航卫星系统中计算多普勒
评论
共有 条评论