How can I draw 117 normal 292 abnormal heart sounds?
5 次查看(过去 30 天)
显示 更早的评论
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))
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Measurements and Spatial Audio 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!