-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathpsembed.m
38 lines (36 loc) · 918 Bytes
/
psembed.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
function [ M ] = psembed( tsdata, E, tau)
%PSEMBED Phase space embedding of a times series.
% PSEMBED(tsdata, E, tau) performs a phase space reconstruction
% (embedding) in E dimensions, with a time lag tau, based on the time
% series in tsdata.
%
% see also xmap
switch (nargin)
case 3
%
otherwise
error('psembed:argchk','Wrong number of arguments arguments');
end
%
% N is the data size, i.e. the number of points in tsdata
%
N = numel(tsdata);
%
% N_vec is the number of phase space vectors in the embedding, using the N
% points from tsdata to embed in E dimensions with time lag tau.
%
N_vec = N-(E-1)*tau;
%
% Allocate memory for the embedded manifold in the matrix M.
%
M = zeros(N_vec,E);
%
% Now construct the phase-space embedded manifold, using the time-delayed
% values from tsdata.
%
for m=1:N_vec
for j=1:E
M(m,j) = tsdata(m+(E-j)*tau);
end
end
end