dynamic time warp matlab economic data

2 次查看(过去 30 天)
I would like to apply the dynamic time warp in economic data of capb i calculated and imf capb. How to code the dynamic time warp in matlab using the two time seriese data.

回答(1 个)

Walter Roberson
Walter Roberson 2022-5-23
Signal processing toolbox, dtw
  1 个评论
Eugene Msizi Buthelezi
Good Day
I am trying to apply the DTW, i have tWo economic varaibles name, [tvp_elstcy_CAPB and capb_imf1], years1, it a time series fron 1979 to 2020 it not balanced, can am not able to apply DTW code below what is that am doing wrong i have atteched files as well.
% DTW & CDTW example
% Sinusoidal signals temporal alignment
clear all
clc
close all
load matlab.mat
%fs=125;
%f1=1; A1=1;
%f2=5; A2=0.8;
%years1=0:1/fs:1/(2*f1);
%years1=0:1/fs:2/(2*f2);
%n1=(A1/10)*rand(size(years1));
%n2=(A2/8)*rand(size(years1));
%tvp_elstcy_CAPB=A1*sin(2*pi*f1*years1)+n1; % 1st sinusoid with noise addition
%capb_imf1=A2*sin(2*pi*f2*years1)+n2; % 2nd sinusoid with noise addition
figure; hold on;
plot(years1,tvp_elstcy_CAPB,'b');
plot(years1,capb_imf1,'r');
grid;
xlabel('time (s)');
ylabel('amplitude (mV)');
title('Original disaligned waves');
pflag=1;
%%
[dtw_Dist,D,dtw_k,w,tvp_elstcy_CAPBw,capb_imf1w]=dtw(tvp_elstcy_CAPB,capb_imf1,pflag);
dtw_Dist, dtw_k
[cdtw_Dist,D,cdtw_k,w,tvp_elstcy_CAPBw,capb_imf1w]=cdtw(tvp_elstcy_CAPB,capb_imf1,pflag);
cdtw_Dist, cdtw_k

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by