-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathexample_oemd_fig2.m
38 lines (28 loc) · 957 Bytes
/
example_oemd_fig2.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
%%
% Example of Online EMD with synthetic data
%%
figure();
%% Input data
% Toy signal
samp = pi/2:.5:10000;
comp1 = sin(samp);
comp2 = sin(linspace(pi/2,10000/10,length(samp)));
comp3 = sin(linspace(pi/2,10000/30,length(samp)));
trend = linspace(0,10,length(samp));
x = comp1 + comp2 + comp3 + trend;
%% Parameters
nbExtrema = 10; % Size of the sliding window (number of extrema per window) (must be higher than 10)
nbMaxIMF = -1; % Number of IMFs to extract (-1 for unlimited)
%% Initialization
stage = oemd_init(nbMaxIMF,nbExtrema,0); %Initializate data structures
%% Execution
%Simulate data stream
'Press any key to add data'
sizeDataPkt = 20; % arrival rate of the data (This is NOT the window size!)
for i=1:sizeDataPkt:length(x)-sizeDataPkt
newDataPkt = x(i:i+sizeDataPkt-1);
stage(1).data = [stage(1).data newDataPkt]; %add new samples to the stream
stage = oemd_iter(stage); % iterate
plotIMFs(stage);
pause
end