필터 지우기
필터 지우기

How can I draw 117 normal 292 abnormal heart sounds?

조회 수: 2 (최근 30일)
Cey
Cey 2023년 4월 2일
댓글: Star Strider 2023년 4월 13일
I have a total of 409 heart sounds, 117 of which are normal and 292 of which are abnormal. I have prepared separate codes normally and abnormally, how should I go about drawing each sound?
The audio files were not added because they were too large, this is the example for which I found the code: https://www.mathworks.com/matlabcentral/fileexchange/65286-heart-sound-classifier
For example;
% fs:2000
[PCG_normal, fs] = audioread('a0011.wav');
p_normal = audioplayer(PCG_normal, fs);
play(p_normal, [1 (get(p_normal, 'SampleRate') * 3)]);
% Plot the sound waveform
plot(PCG_normal(1:fs*3))
[PCG_abnormal, fs] = audioread('a0001.wav');
p_abnormal = audioplayer(PCG_abnormal, fs);
play(p_abnormal, [1 (get(p_abnormal, 'SampleRate') * 3)]);
% Plot the sound waveform
plot(PCG_abnormal(1:fs*3))

채택된 답변

Star Strider
Star Strider 2023년 4월 2일
편집: Star Strider 2023년 4월 2일
Drawing them depends on the result you want. Heart sounds are best displayed as time-frequency plots, so I would plot them using the pspectrum function with the 'spectrogram' option. (Ideally, they should be plotted along with the corresponding Lead II EKG trace.)
Plotting 409 of them might be something of a challenge, since tiledlayout and subplot would create axes that are too small to easily visualise.
EDIT — (2 Apr 2023 at 17:32)
This emphasizes the time-frequency characteristics of the phonocardiogram signals —
Uz1 = unzip('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1342909/heart%20sound.zip');
Uz2 = unzip('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1342914/records.zip');
[PCG_normal, fsn] = audioread(Uz1{2});
p_normal = audioplayer(PCG_normal, fsn);
Ln = size(PCG_normal,1);
tn = linspace(0, Ln-1, Ln)/fsn;
play(p_normal, [1 (get(p_normal, 'SampleRate') * 3)]);
% Plot the sound waveform
figure
plot(PCG_normal(1:fsn*3))
[PCG_abnormal, fsa] = audioread(Uz1{1});
p_abnormal = audioplayer(PCG_abnormal, fsa);
La = size(PCG_abnormal,1);
ta = linspace(0, La-1, La)/fsa;
play(p_abnormal, [1 (get(p_abnormal, 'SampleRate') * 3)]);
% Plot the sound waveform
figure
plot(PCG_abnormal(1:fsa*3))
figure
tiledlayout(2,2)
nexttile
pspectrum(PCG_normal, fsn,'spectrogram')
colormap(turbo)
nexttile
pspectrum(PCG_abnormal, fsa,'spectrogram')
colormap(turbo)
nexttile
plot(tn,PCG_normal)
xlabel('t')
ylabel('Amplitude')
title('PCG Normal')
xlim([0 max(tn)])
grid
nexttile
plot(ta,PCG_abnormal)
xlabel('t')
ylabel('Amplitude')
title('PCG Abnormal')
xlim([0 max(ta)])
grid
.
  댓글 수: 10
Cey
Cey 2023년 4월 13일
thank you very much just as what i wanted
Star Strider
Star Strider 2023년 4월 13일
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Measurements and Spatial Audio에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by