Clear Filters
Clear Filters

draw pairwise line between each sample of two curves

6 views (last 30 days)
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

Accepted Answer

KSSV
KSSV on 11 Jun 2018
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

More Answers (0)

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!