How can I draw 117 normal 292 abnormal heart sounds?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Star Strider
il 2 Apr 2023
Modificato: Star Strider
il 2 Apr 2023
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 Commenti
Star Strider
il 13 Apr 2023
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Measurements and Spatial Audio in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!