1. Introduction
1 Heart sound:
The sound produced when the heart contracts and relaxes. It can be heard on the chest wall with ears or stethoscope, or recorded with electronic equipment (phonocardiogram). It can be divided into the first heart sound (S1) and the second heart sound (S2). (It can be heard under normal circumstances). The third heart sound (S3 is usually only heard in children and adolescents), and the fourth heart sound (S4 is rarely heard under normal circumstances). Heart sounds generated from the heart are transmitted to the surface of the chest wall through tissue mediation, with bone conduction being the best.
Heart sound is a reflection of the mechanical movement of the heart and cardiovascular system, which contains the physiological and pathological information of the various parts of the heart itself and the interactions between them. The recognition and classification of heart sound signals are of great significance to the diagnosis of cardiovascular system diseases. Its accuracy and reliability determine the effect of diagnosis and treatment of heart disease patients. Early recognition and classification of heart sounds were done by doctors based on the results of auscultation. Obviously, this process is subjective and not highly reliable. With the continuous development of signal processing and analysis technology, the research on heart sounds has gradually entered the stage of quantitative analysis from qualitative analysis. Many biomedical engineering researchers at home and abroad use traditional pattern recognition methods and neural network methods for the recognition and classification of heart sounds, hoping to realize automatic interpretation and automatic diagnosis of heart sounds in order to provide clinicians with practical auxiliary diagnostic information. In addition, the recognition and classification of heart sounds also help to understand the mechanism of heart sound production.
Heart sound signal research mainly uses microelectronics technology, detection technology, modern digital signal processing technology and biomedical engineering technology to study and reveal the relationship between heart sound and heart disease.
Regardless of how large the unit is, physiological parameters such as a person's weight, heart rate, and blood pressure are all time-varying, which is called the variability of heart rate or blood pressure.
Heart sounds are mechanical vibrations caused by myocardial contraction and relaxation, valve opening and closing, and blood flow impacting the ventricular wall and aorta during the cardiac cycle. It is transmitted to the chest wall through surrounding tissues, and the ears are close to the chest wall or the stethoscope is placed on the chest wall. Location, the sound heard is usually easy to hear the first and second heart sounds, and sometimes the third or fourth heart sounds are heard in some cases.
The first heart sound: S1, which occurs at the beginning of the systole, has a low pitch and a long duration (about 0.15 seconds). The causes include the contraction of the ventricular muscles, the sudden closing of the atrioventricular valve, and the subsequent ejection of blood into the aorta. The best auscultation site for the first heart sound is in the fifth intercostal space on the midclavicular line or on the right edge of the sternum. Compared with the 0.020.04s after the QRS wave on the ECG starts, the
second heart sound: S2, which occurs at the beginning of the diastole, takes a time of 0.080.15s , has a higher frequency and a shorter duration (about 0.08 seconds). The reason is that the semilunar valve closes, the valves collide with each other, and the vibration caused by the deceleration of blood in the aorta and the rapid drop of intraventricular pressure. The best auscultation sites for the second heart sound are the aortic valve area on the right side of the second intercostal space and the pulmonary valve area on the left side. Relative to the end of the T wave.
The third heart sound and the fourth heart sound: The
third heart sound S3 occurs 0.1 to 0.2 seconds after the second heart sound, and has a low frequency. Its production is related to the rapid flow of blood into the ventricle to cause the ventricles and valves to vibrate. It is usually only heard by children. Because it is easier to conduct to the body surface. It is equivalent to 0.12~0.20s behind the second heart sound of T wave.
The fourth heart sound S4 is caused by atrial contraction, also known as atrial sound, which is equivalent to 0.15~0.18s after the P wave on the electrocardiogram, with a low amplitude.
Heart sound murmurs interfere with normal heart sounds to a certain extent, but the appearance of heart sound murmurs has practical application value and clinical significance for heart sound signal analysis.
According to the relationship between the time of the murmur and the S1, S2 heart sounds, it can be divided into early, middle and late murmurs. The intensity of the noise can generally be classified according to its amplitude compared with S1. Greater than S1, strong. Less than S1, greater than 1/3S1, medium. Less than 1/3 of S1 is low, and only slight vibration is very low-amplitude noise.
Since the heart sound signal is a weak biological signal of the human body under the background of strong noise, the heart sound signal is an unstable natural signal emitted by a complex living body. Changes in heart sounds and the appearance of murmurs are often early symptoms of organic heart disease. Changes in the physical structure of the heart will directly affect and change the heart sound signal.
At present, the widely used electrocardiogram is the best method to detect the time change and conductivity of the heart, but it cannot be used to detect the inotropic congenital heart valve damage. Cardiac mechanical activity disorders caused by pathological changes in cardiac conduction tissues will not first be reflected on the electrocardiogram, but can be first reflected on the heart sound signals. Only when the obstruction of coronary heart disease reaches more than 70% can the ECG signal change. In fact, it can change the heart sound signal when it reaches 25%.
2 Abnormal heart sounds
Including S2 and S2 abnormalities, systolic and diastolic additional sounds (or additional sounds).
The first heart sound is abnormal. Refers to the strengthening, weakening or splitting of S1. It is best to use auscultation to estimate the loudness of S1, and the ability to judge the sound of the heart sound is limited. The clinical conditions of S1 increase, decrease or different strength are shown in Table 1. S1 split refers to the distance between M1 and T1>0.04sec, which can be seen in normal children, young people and thin people, and has no significance. When S1 is abnormally split, the distance between M1 and T1 can be greater than 0.06 seconds, which can be seen in electrical activation delay (such as right bundle branch block, etc.), mechanical activity delay (such as atrial septal defect, severe mitral stenosis, etc.). Auscultation S1 split in the mitral The valve and tricuspid valve area are clearest when sitting and when exhaling.
The second heart sound is abnormal. Including S2 enhancement, weakening or splitting.
S2 enhancement is divided into P2 enhancement and A2 enhancement. P2 enhancement is seen in the increase of pulmonary blood flow (such as interval Defect), increased pulmonary vascular resistance; increased pulmonary venous pressure (such as mitral valve stenosis). P2 hyperactivity is generally heard in the pulmonary valve area. A2 enhancement is seen in increased systemic resistance or increased blood flow, conducted to the pulmonary valve and apical area, seen in high Blood pressure, etc.
S2 weakening is divided into P2 weakening and A2 weakening. P2 weakening is seen in pulmonary artery pressure, pulmonary blood flow, or pulmonary valve stenosis. A2 weakening is seen in low systemic resistance, blood flow, low blood pressure, aortic stenosis or severe closure Incomplete.
S2 split may be physiological. The right ventricular ejection ends slightly later than the left ventricle. P2 appears delayed during inhalation, and S2 split can be heard at this time. However, when A2 and P2 are close or overlapped during exhalation, the split disappears. This It is seen in adolescents and is obvious on auscultation of the pulmonary valve area. It can disappear when sitting.
Abnormal S2 division includes wide division, fixed division, reverse division, and division reduction. Wide division means that S2 division does not disappear during exhalation, and it is seen in the right ventricular ejection time prolonged Or the left ventricular ejection time is shortened. S2 fixed split means that the A2-P2 interval does not change significantly or changes <0.02sec during breathing, which is seen in atrial septal defect with large shunt flow. S2 reverse split means that A2 is after P2. A2-P2 split is not obvious during inhalation, P2 appears earlier and splits and widens during exhalation. It is seen in delayed closure of the aortic valve. S2 splitting is often caused by the early appearance of severe pulmonary hypertension P2.
3 Heart sound signal analysis method: The
traditional spectrum analysis method uses the fast Fourier transform to correlate the time and frequency domains. But FFT time-frequency domain is separated, and the frequency characteristic of the signal is unchanged from time to time, or the statistical characteristic is stable as the premise.
The traditional steady-state analysis method reflects the static frequency spectrum characteristics of the signal. For biological and physiological signals, including human heart sound signals, they exhibit non-stationary time-varying characteristics due to the influence of the environment. Therefore, it is difficult to accurately reflect the dynamic changes of the heart sound signal by using the classical spectrum analysis method.
On the basis of traditional heart sound analysis, many methods have been proposed:
1. Short-time Fourier Transform (STFT)
2. Wavelet Transform
3. Other time-frequency analysis methods
2. the source code
clc;
clear;
close all;
%% extract signal
M = importdata( '3.txt' );
fsample = 1000 ;% sampling rate is 1 KHz
[mx,my]=size(M);
Signal=M(:, 2 ); The first column of %M is the time, and the second column is the signal
length= floor (mx/2 );% takes half of the original signal.
S=Signal( 1 :length);
%% high-pass filter to remove the influence of baseline drift
disp( '-------------------------------------------' );
disp( '1: Toolbox Butterworth High Pass Filter' );
disp( '2: IIR high-pass filter' );
disp( '3: FIR high-pass filter' );
disp( '4: median filter' );
disp( '5: sparse wavelet filtering' );
disp( '6: median + wavelet filter' );
disp( '-------------------------------------------' );
choose=input( 'Select filtering method choose=' );
function [s, err_mse, iter_time]=sparseOMP(x,A,m,varargin)
[n1 n2]=size(x);
if n2 == 1
n=n1;
elseif n1 == 1
x = x ' ;
n=n2;
else
error( 'x must be a vector.' );
end
sigsize = x ' *x/n;
initial_given = 0 ;
err_mse = [];
iter_time = [];
STOPCRIT = 'M' ;
STOPTOL = ceil (n/4 );
MAXITER = n;
verbose = false ;
s_initial = zeros(m, 1 );
GradSteps = 'auto' ;
alpha = 1 ;
weakness = 1 ;
if verbose
display ( 'Initialising...' )
end
switch nargout
case 3
comp_err = true ;
comp_time = true ;
case 2
comp_err = true ;
comp_time = false ;
case 1
comp_err = false ;
comp_time = false ;
case 0
error( 'Please assign output variable.' )
otherwise
error ( 'Too many output arguments specified' )
end
% Put option into nice format
Options ={};
OS=nargin -3 ;
c = 1 ;
for i = 1 :OS
if isa(varargin{i}, 'cell' )
CellSize=length(varargin{i});
ThisCell=varargin{i};
for j = 1 :CellSize
Options{c}=ThisCell{j};
c=c+ 1 ;
end
else
Options{c}=varargin{i};
c=c+ 1 ;
end
end
OS=length(Options);
if rem (OS, 2 )
error ( 'Something is wrong with argument name and argument value pairs.' )
end
for i = 1 : 2 :OS
switch Options{i}
case { 'stopCrit' }
if (strmatch(Options{i+ 1 },{ 'M' ; 'corr' ; 'mse' ; 'mse_change' }, 'exact' ));
STOPCRIT = Options{i+ 1 };
else error( 'stopCrit must be char string [M, corr, mse, mse_change]. Exiting.' ); end
case { 'stopTol' }
if isa (Options{i+ 1 }, 'numeric ' ) ; STOPTOL = Options{i+ 1 };
else error( 'stopTol must be number. Exiting.' ); end
case { 'P_trans' }
if isa (Options{i+ 1 }, 'function_handle' ); Pt = Options{i+ 1 };
else error( 'P_trans must be function _handle. Exiting.' ); end
case { 'maxIter' }
if isa (Options{i+ 1 }, 'numeric' ) ; MAXITER = Options{i+ 1 };
else error( 'maxIter must be a number. Exiting.' ); end
case { 'wf' }
if isa (Options{i+ 1 }, 'numeric' ) ; alpha = Options{i+ 1};
if alpha < 1 weakness = 0 ; else alpha = 1 ; weakness = 1 ; end
else error ( 'wf must be a number. Exiting.' ) ; end
case { 'verbose' }
if isa (Options{i+ 1 } , 'logical' ) ; verbose = Options{i+ 1 };
else error( 'verbose must be a logical. Exiting.' ); end
case {'start_val' }
if isa (Options{i+ 1 }, 'numeric' ) && length (Options{i+ 1 }) == m;
s_initial = Options{i+ 1 };
initial_given = 1 ;
else error( 'start_val must be a vector of length m. Exiting.' ); end
case { 'GradSteps' }
if isa (Options(i+ 1 }, 'numeric' ) || strcmp (Options(i+ 1 }, 'auto' ) ;
GradSteps = Options{i+ 1 };
else error( 'start_val must be a vector of length m. Exiting.' ); end
otherwise
error ( 'Unrecognised option. Exiting.' )
end
end
if strcmp (STOPCRIT, 'M' )
maxM =STOPTOL;
else
maxM=MAXITER;
end
if nargout >= 2
err_mse = zeros(maxM, 1 );
end
if nargout == 3
iter_time = zeros(maxM, 1 );
end
if isa (A, 'float' ) P =@(z) A*z; Pt =@(z) A ' *z;
elseif isobject (A) P =@(z) A*z; Pt =@(z ) A ' *z;
elseif isa (A, 'function_handle' )
try
if isa (Pt, 'function_handle' ) ; P=A;
else error( 'If P is a function handle, Pt also needs to be a function handle. Exiting.' ); end
catch error ( 'If P is a function handle, Pt needs to be specified. Exiting.') ; end
else error ( 'P is of unsupported type. Use matrix, function_handle or object. Exiting.' ) ; end
if initial_given == 1 ;
IN = find(s_initial);
Residual = xP(s_initial);
s = s_initial;
oldERR = Residual ' *Residual/n;
else
IN = [];
Residual = x;
s = s_initial;
sigsize = x ' *x/n;
oldERR = sigsize;
end
mask=zeros(m, 1 );
mask( ceil (rand*m)) = 1 ;
nP=norm(P(mask));
if abs ( 1 -nP) >1e-3 ;
display( 'Dictionary appears not to have unit norm columns.' )
end
if verbose
display ( 'Main iterations...' )
end
tic
t = 0 ;
normA=(sum(A.^ 2 , 1 )).^ 0.5 ;
NI = 1 :size(A, 2 );
p=zeros(m, 1 );
DR=Pt(Residual);
[v I]=max( abs (DR(NI))./normA(NI) ');
INI = NI(I);
IN=[IN INI];
NI(I) = [];
if weakness ~= 1
[vals inds] = sort(abs(DR),' descend ' );
I=inds( find( vals >= alpha * v) );
end
IN = union (IN,I);
if strcmp (STOPCRIT, 'M' ) & length (IN) > = STOPTOL
IN=IN( 1 :STOPTOL);
end
MASK=zeros(size(DR));
pDDp = 1 ;
done = 0 ;
iter = 1 ;
while ~done
% Select new element
if isa (GradSteps, 'char' )
if strcmp (GradSteps, 'auto' )
% finished = 0 ;
% while ~finished
% Update direction
if iter== 1
p(IN)=DR(IN);
Dp=P(p);
else
MASK(IN) = 1 ;
PDR=P(DR.*MASK);
b=-Dp ' *PDR/pDDp;
p(IN)=DR(IN) +b*p(IN);
Dp=PDR +b* Dp;
end
% Step size
% Dp=P(p);% =P(DR(IN)) +b P(p(IN));
pDDp=Dp ' *Dp;
a=Residual ' *Dp/(pDDp);
% Update coefficients
s=s+a*p;
% New Residual and inner products
Residual=Residual-a*Dp;
DR=Pt(Residual);
% select new element
[v I]=max( abs (DR(NI))./normA(NI) ');
INI = NI(I);
if weakness ~= 1
[vals inds] = sort(abs(DR),' descend ' );
I=inds( find( vals >= alpha * v) );
end
IN = union (IN,INI);
NI(I) = [];
if strcmp (STOPCRIT, 'M' ) & length (IN) > = STOPTOL
IN=IN( 1 :STOPTOL);
end
else
error ( 'Undefined option for GradSteps, use ' 'auto' ' or an integer.' )
end
elseif isa (GradSteps, 'numeric' )
% Do GradSteps gradient steps
count = 1 ;
while count<=GradSteps
% Update direction
if iter== 1
p(IN)=DR(IN);
Dp=P(p);
else
MASK(IN) = 1 ;
PDR=P(DR.*MASK);
b=-Dp ' *PDR/pDDp;
p(IN)=DR(IN) +b*p(IN);
Dp=PDR +b* Dp;
end
% Step size
% Dp=P(p);
pDDp=Dp ' *Dp;
a=Residual ' *Dp/(pDDp);
% Update coefficients
s=s+a*p;
% New Residual and inner products
Residual=Residual-a*Dp;
DR=Pt(Residual);
count=count + 1 ;
end
% select new element
[v I]=max( abs (DR(NI))./normA(NI) ');
INI = NI(I);
if weakness ~= 1
[vals inds] = sort(abs(DR),' descend ' );
I=inds( find( vals >= alpha * v) );
end
IN = union (IN,INI);
NI(I) = [];
if strcmp (STOPCRIT, 'M' ) & length (IN) > = STOPTOL
IN=IN( 1 :STOPTOL);
end
else
error ( 'Undefined option for GradSteps, use ' 'auto' ' or an integer.' )
end
ERR =Residual ' *Residual/n;
if comp_err
err_mse (iter) =ERR;
end
if comp_time
iter_time (iter) =toc;
end
if strcmp (STOPCRIT, 'M' )
if length (IN) > = STOPTOL
done = 1 ;
elseif verbose && toc-t> 10
display( sprintf ( 'Iteration %i. --- %i selected elements' ,iter ,length(IN)))
t=toc;
end
elseif strcmp (STOPCRIT, 'mse' )
if comp_err
if err_mse (iter) <STOPTOL ;
done = 1 ;
elseif verbose && toc-t> 10
display( sprintf ( 'Iteration %i. --- %i mse' ,iter ,err_mse(iter)))
t=toc;
end
else
if ERR<STOPTOL;
done = 1 ;
elseif verbose && toc-t> 10
display( sprintf ( 'Iteration %i. --- %i mse' ,iter ,ERR))
t=toc;
end
end
elseif strcmp (STOPCRIT, 'mse_change' ) && iter > = 2
if comp_err && iter >= 2
if ((err_mse(iter -1 )-err_mse(iter))/sigsize <STOPTOL);
done = 1 ;
elseif verbose && toc-t> 10
display( sprintf ( 'Iteration %i. --- %i mse change' ,iter ,(err_mse(iter -1 )-err_mse(iter))/sigsize ))
t=toc;
end
else
if ((oldERR-ERR)/sigsize <STOPTOL) ;
done = 1 ;
elseif verbose && toc-t> 10
display( sprintf ( 'Iteration %i. --- %i mse change' ,iter ,(oldERR-ERR)/sigsize))
t=toc;
end
end
elseif strcmp (STOPCRIT, 'corr' )
if max ( abs (DR)) <STOPTOL ;
done = 1 ;
elseif verbose && toc-t> 10
display( sprintf ( 'Iteration %i. --- %i corr' ,iter ,max( abs (DR))))
t=toc;
end
end
% Also stop if residual gets too small or maxIter reached
if comp_err
if err_mse (iter) <1e-16
display ( 'Stopping. Exact signal representation found!' )
done = 1 ;
end
else
if iter> 1
if ERR< 1e-16
display( 'Stopping. Exact signal representation found!' )
done = 1 ;
end
end
end
if iter >= MAXITER
display( 'Stopping. Maximum number of iterations reached!' )
done = 1 ;
end
if ~done
iter=iter+ 1 ;
oldERR=ERR;
end
end
if nargout >= 2
err_mse = err_mse( 1 :iter);
end
if nargout == 3
iter_time = iter_time( 1 :iter);
end
if verbose
display ( 'Done' )
end
Copy code
3. running results
4. remarks
Version: 2014a
complete code or writing plus 1564658423