# Wolfram Mathematica

## Compare Two ECG Signals Using DTW

Compare two ECG signals of heartbeats using WarpingDistance.

In[1]:=
```ecg1 = TemporalData[TimeSeries, {CompressedData[" 1:eJwl1wk0VO//B3BJZSkktEklZWklW8igDdkSUSlkS6JsWVKypFBkKYpKWrRQ lCVL3pLs+26Yca9dqaQIlf7P9/d3jvM5M889M3Of87qf5/1Ze+KMiT0nBwfH HPI/MpeD487t//46ERrw/7VR+P9rk3nC/+qdZ9f/V4/u1Uj4r1YJCN38rw7O 47nxX21IfXfxf9cPG274rz4PWncgntSnydkpN0j9+snr5zlSpZ/lKYiQ6qpX e744vhM83FYvw2M7kXl0mPvclU4E209yap/sRHLf8f6u1Z3YkRa83j6sA16c B60V3duxw0rcuP9xK75ZcunYczdjm6eWb8GZelgd4RTV21eBjLTwrWVzSyC8 MVM/x6kQTw/YMaL7C8BZ7WKmbP0epS8enLS/Ww5jMZ7v99bXo/b8/HWGys0o 4VNf4qrcBuWp3X/kr3ZgQmpnp8uKLohHRpjWMXugerbkPZ3bizt6C1+zt9NY MeY+7c1Vjo4nFUGB7C7G6nCH3puZwwwN+faOaotOhmi9WzdTuREdgt8PntIf QMKIs6+szSAsxNMtfy7vBVNDZ0D/HQtua2c0tY90YZ737Z3KRkwwbbRKguU7 MYdL5L5MZjsO34gXm85qRWLrySE5pWb0po/vF1NvwKqqJHPXkkpczbH6xPO8 BNf4eZlpjrng0AkNKP7xGJqNgiECuZ6gEku37tkZw+DYY7folF8845KG74Ji 3WCGoG+kmv+/m2gZVQi/IJAJffesnwVrgDdP+niPK5RjzV1Po/KWOkyJ86z4 OdkE/0ranFOoDRzv5cs8H3YgVHe6Ke8JE2rjBi//ru+Gn+dLKW8FFnS/K44s H2FBfHNEf9ARNkbuXGs9lcTGmhmbj4FFbCyK5aWO17BRIZH/kLOOjacTiv3J FWyoa7ttOA02mDGZokav2dDWvOF48DEbgu91x3wS2MjKnJBEBBvh9f456wPY +GQ7FJrmzoan+54vJg5sBCRvrF9Gvi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F7fhlQnztcZr4VET8XR+/cVmM+BvisLjtTPwJymzs30PW vYRCL+wm/mbztidYEn9Ta44KxRJ/wxe/PB0i/u6XH+k9TPzF/3vzYIT4s8uV dblF/M3bWSdpTfx15C/U3Ev8+dJFUTrE3/bDxZoOxN/Hoj977hJ/zxL+bRkk /sZT+0w2EH8XDFnlC7qJuzEJw1ji772zcLUu8de9T7Q4nPg7JxXroU/8uU9c 9VlN/LUp2sceJ/68nbr5oog/WmK92Qfiz2TD2qbV69vha31R+w/x9zprQ0kA 8Wc3RPP9Jf5UjTXsM4m/P2LPbu4LrEdYV+FVdeKv9P7JR1eIP9W3/dr2xN+2 eWay/HNYuOV8e/Vl4q/XveZoI9nPp/LL88OIv1uT+V/uE3/79pVKGBJ/z0ti A58Sf08upBmaE398njuEIom//wPA8bVT "], {{0, 10, Rational[1, 100]}}, 1, {"Continuous", 1}, {"Discrete", 1}, 1, { ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}}, False, 10.2]["Values"]; ecg2 = TemporalData[TimeSeries, {CompressedData[" 1:eJwllwk0Ve3/xTPmrYgiyhAaREVoUOEi4Y0GGqQoRBFNKIrQJKkUIUpSIkUZ kihsZBYuLtd1h3NM0WxIRdL/eX//u9Zd33XPOuusc59nP/uzt5rrMTt34SlT pgiR7weRKVPuJPz34YAl8//TpS/uf9Nq+q3/TZMEif9NA4XfYf/NUbFVe/+b /q75cv9NxY9s/3gyVzcb3Ykh09yhNDqIzF1qq1SmkTnHgSUtf5uD8OpVVwtu kOeHjGol+ZP7jR49/aHPQZ/CpeDKqA7E80wHz1uy4cuYu+OkTBumDC92dfjS jLKGK7a7nr9DRkibhMKtKuTsz9SrffkWlcnxn9ZbVuLoS1O9rqI6cO00njXO akad5Uw5lTQWEvaL0+aH2RARC/UMf87B3x+KVzan82FY87eNkdYFWTFXxQuh ApSKXly9QP4W/v4K83aT6WKIf5oSuTGHzRgL5x3UXdmCmKqJqZ+u9KJ7xvRy yZ09uKCNfXr7BFgU903QO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, False, 10.2]["Values"]; ListLinePlot[{ecg1, ecg2}, PlotRange -> Full, AxesLabel -> {"time (s)", "voltage (mV)"}, DataRange -> {0, 10}, ImageSize -> 400]```
Out[1]=

Compute the warping distance between the two signals.

In[2]:=
`WarpingDistance[ecg1, ecg2]`
Out[2]=

Warp and plot both signals based on the time warping correspondence.

In[3]:=
`{n1, n2} = WarpingCorrespondence[ecg1, ecg2];`
In[4]:=
```ListLinePlot[{ecg1[[n1]], ecg2[[n2]]}, PlotRange -> Full, AxesLabel -> {"time (s)", "voltage (mV)"}, DataRange -> {0, 10}, ImageSize -> 400]```
Out[4]=