|
a |
|
b/indian-institute-of-science-fetal-heart-sound-database-iiscfhsdb-1.0/example_code.m |
|
|
1 |
clear all; |
|
|
2 |
close all; |
|
|
3 |
|
|
|
4 |
|
|
|
5 |
%% Read a .wav file |
|
|
6 |
|
|
|
7 |
filename='D:\Data\subject_32.wav'; %% Specify filename to read |
|
|
8 |
|
|
|
9 |
[y,fs]=audioread(filename); |
|
|
10 |
|
|
|
11 |
% This inbuilt MATLAB function reads the audio file from the specified address. |
|
|
12 |
% The sampling frequency(fs) is read from the audio file directly. |
|
|
13 |
% For our dataset,sampling frequency is 2000 Hz. |
|
|
14 |
% y - stores the fPCG raw data. |
|
|
15 |
|
|
|
16 |
%% Plotting the Data |
|
|
17 |
|
|
|
18 |
t=(1:length(y))/fs; %% Time of the signal in seconds |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
plot(t,y); %% this function plots the time vs signal. |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
%% Comb filter |
|
|
25 |
|
|
|
26 |
fo=50; %% Cut-off frequency for comb filter |
|
|
27 |
q=35; %% Quality factor |
|
|
28 |
bw = (fo/(fs/2))/q; %% Bandwidth of the filter |
|
|
29 |
[b,a] = iircomb(fs/fo,bw,'notch'); %% and b are the filter coefficients |