-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathEmpirical_Mode_Decomposition_EMD.m
68 lines (56 loc) · 1.93 KB
/
Empirical_Mode_Decomposition_EMD.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
% Empirical Mode Decomposition (EMD)
% This code is related to the following section of [the paper](https://arxiv.org/abs/2403.17181):
%
% Section III: SIGNAL TRANSFORMATION AND ANALYSIS
% F. Hilbert–Huang Transform
% 1) Empirical Mode Decomposition (EMD)
%
% For more details please refer to the paper at: https://arxiv.org/abs/2403.17181.
x = table2array(readtable('vib.csv')); % Load random vibration signal
% he vibration signal extracted from the PU dataset:
% https://mb.uni-paderborn.de/en/kat/main-research/datacenter/bearing-datacenter/data-sets-and-download
fs = 64000; % Sampling frequency
t = (0:length(x)-1)/fs; % Time vector
plot(t,x) % Plot the signal.
x = x - mean(x); % Remove mean (DC component).
% Perform Empirical Mode Decomposition (EMD)
[imfs, residual] = emd(x);
% Number of IMFs
numIMFs = size(imfs, 2);
% Figure setup for plotting
figure;
% Iterate over each IMF
for i = 1:numIMFs
% Time-domain plot of the IMF
subplot(numIMFs+1, 2, 2*i-1);
plot(imfs(:, i));
title(['IMF ', num2str(i)]);
set(gca, 'XTick', [], 'YTick', []); % Remove axis labels
% Frequency-domain plot (FFT) of the IMF
subplot(numIMFs+1, 2, 2*i);
n = length(imfs(:, i)); % Number of points in IMF
fft_imf = fft(imfs(:, i));
P2 = abs(fft_imf/n);
P1 = P2(1:n/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = fs*(0:(n/2))/n;
plot(f, P1);
title(['FFT of IMF ', num2str(i)]);
set(gca, 'XTick', [], 'YTick', []); % Remove axis labels
end
% Plot for the residual
subplot(numIMFs+1, 2, 2*numIMFs+1);
plot(residual);
title('Residual');
set(gca, 'XTick', [], 'YTick', []);
% FFT for the residual
subplot(numIMFs+1, 2, 2*numIMFs+2);
n = length(residual);
fft_residual = fft(residual);
P2 = abs(fft_residual/n);
P1 = P2(1:n/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = fs*(0:(n/2))/n;
plot(f, P1);
title('FFT of Residual');
set(gca, 'XTick', [], 'YTick', []);