In the 40 * 40 1000 sampling points in the phase space, the offset is 0.5 * 250, look not to understand why take 2 31 power program, ask the great spirit guide
Tau=floor (fs * 0.5); % 125
N=40;
% %
Ecg2=ecg - min (ecg);
Ecg2=2 ^ 31 * ecg2/Max (ecg2);
The delta=ceil (Max (ecg2 + 1)/n); % 53687092
% %
Di=zeros (n);
For k=1: length (ecg) - tau
Zx=1 + floor (ecg2 (k)/delta);
Zy=1 + floor (ecg2 (k + tau)/delta);
% di (zx, zy)=di (zx, zy) + 1;
Di (zx, zy)=1;
End