What I'm trying to do is connecting two sets of points (x,y based) with a line. The line should be drawn based on the index of the two sets. Meaning set1(x,y)
should be connected to set2(x,y)
where x
and y
are the same indices in both sets.
What I have so far is the following:
set1 = [1,2; 3,4; 5,6];
set2 = [10,20; 30,40; 50,60];
plot(set1(:,1),set1(:,2),'b+',set2(:,1),set2(:,2),'g+')
Displaying me the items of set1
in blue points and the set2
in green points. Meaning I want to plot a line between [1,2]
and [10,20]
Is there any build-in function for this, or do I need to create a third set representing the lines e.g. [ [1,2; 10,20], [3,4; 30,40], ... ]
?