draw pairwise line between each sample of two curves

2 ビュー (過去 30 日間)
tala
tala 2018 年 6 月 11 日
コメント済み: tala 2018 年 6 月 11 日
hello. I have two curves in a graph. how can i draw lines between each sample of curves. for example draw a line between sample 10 of curve 1 and between sample 10 of curve 2? both curves consist of 45 samples. and i want to draw line between each two corresponding samples. could anyone help me please?
s1: first signal
s2:second signal
figure; hold on;
plot(s1(:,1),s1(:,2),'.b-')
plot(s2(:,1),s2(:,2),'.r-')
grid;
%xlabel('time (s)');
%ylabel('amplitude (mV)');
title('Original disaligned waves');
pflag=1;
[dtw_Dist,D,dtw_k,w,s1w,s2w]=dtw(s1(:,1),s2(:,1),pflag);
dtw_Dist, dtw_k
the image attached is the figure consisting my two curves

採用された回答

KSSV
KSSV 2018 年 6 月 11 日
N = 10 ;
x = 1:N ;
S1 = [x' rand(N,1)] ;
S2 = [x' rand(N,1)+5] ;
figure
hold on
plot(S1(:,1), S1(:,2))
plot(S2(:,1), S2(:,2))
for i = 1:N
plot([S1(i,1) S2(i,1)],[S1(i,2) S2(i,2)])
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSmoothing and Denoising についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by