MATLAB: Draw multiple line segments, stairs(), plot() function plotting linesstairs Best Answer You can draw all of the solid or dashed segments at once by providing appropriate coordinates. Place NaN between the pairs:x = [x1 x1 NaN x2 x2 NaN x3 x3];y = [y1 y2 NaN y2 y3 NaN y3 y4];plot(x, y, '-'); %no marker!hold onx = [0 x1 Nan x1 x2 Nan x2 x3];y = [y1 y1 NaN y2 y2 Nan y3 y3];plot(x, y, '--'); %no markerand then draw all of the markers of each typex = [0 x1 x2 x3];y = [y1 y2 y3 y4];plot(x, y, 'o'); %no linex = [x1 x2 x3];y = [y1 y2 y3];plot(x, y, 'o', 'MakerFaceColor', 'k'); %no line, fill the markerTo create the axes as lines with arrows, create annotation arrows; see http://www.mathworks.com/help/matlab/ref/annotationarrow-properties.html Related SolutionsMATLAB: Intersecting lines from coordinates and fixed lines x1=val(:,2);y1=val(:,3);x2=[-226.586 , -238.954];y2=[112.566 , 49.459];plot(x1,y1,x2,y2)P = InterX([x1.';y1.'],[x2;y2]);plot(x1,y1,x2,y2,P(1,:),P(2,:),'ro') MATLAB: Correlation between two row matrices Like that, each value of "a" is correlated to each value of "b", but applying the formula of the correlation, the correlation of two single numbers is NaN. To compute the correlation correctly, traspose the input vectorsresult = corr(a', b'); Related QuestionIf i assign 4 position(x,y) can i make a point and line to connect it together like freehand drawing
Best Answer