draw pairwise line between each sample of two curves

6 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Image Processing and Computer Vision 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by