how can i connect separate lines together in a plot?

how can i connect the red lines together
and the purple lines together.
FYI the have two seperate equations
i would like a vertical line

댓글 수: 4

Either plot the two arrays together by vertical catenation as
plot([XA;XB],[YA;YB])
or just draw the line...
hold on
line([XA(end,:);XB(1,:)],[YA(end,:);YB(1,:)])
figure(1)
plot(X,TEL1(:,2))
plot(Y,TEL2(:,1))
hold on
plot(X,Pressure11(:,2))
plot(Y,Pressure22(:,1))
hold on
hold off
xlabel('LC 40"')
ylabel('HGL & TEL')
this is my problem, my values are in this form,
i used ur code like this.
what did i do wrong?
hold on
line([TEL1(end,:);TEL2(1,:)],[Pressure11(end,:);Pressure22(1,:)])
Dimensions of matrices being concatenated are not consistent.
madhan ravi
madhan ravi 2019년 6월 22일
편집: madhan ravi 2019년 6월 22일
Could you share the missing datas by clicking the paper clip button?
dpb
dpb 2019년 6월 22일
편집: dpb 2019년 6월 22일
Your two arrays apparently don't have the same number of columns...I presume for four lines you either had two of two columns each or four of one...whatever they are, must catenate the same number of columns.
NB: The above code was intended to be indicative of how to solve the questions, not necessarily verbatim because you didn't show us enough to know how your data were stored/plotted.
It should be clear the logic to solve your problem is to either plot each line that is wanted to be connected as a single x,y set of data and then Matlab will automagically draw the line between the points between the two original arrays.
Or, if you've already generated the plot separately as shown, then you simply draw a line from the last x,y pair of the first line to the first x,y pair of the second. The precise syntax for referring to the specific elements of the arrays and putting them together obviously depends on the storage arrangment of that data which we do not know and therefore, can only guess at.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Time Series Events에 대해 자세히 알아보기

태그

질문:

2019년 6월 22일

편집:

dpb
2019년 6월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by