필터 지우기
필터 지우기

Plot straight line between points

조회 수: 60 (최근 30일)
Christo van Rensburg
Christo van Rensburg 2020년 5월 2일
댓글: Christo van Rensburg 2020년 5월 2일
Hi everybody,
I'm trying to plot something like this, but just for a number of datapoints.
But keep on getting something like this instead:
I've tried using 'line' but doesn't work and also 'bo-' in the plot command. My code at the moment is:
xVal = [Ax, Bx, Cx];
yVal = [Ay, By, Cy];
plot(xVal, yVal,'bo-'), grid on, hold on
line(xVal, yVal)
Any help is appreciated thanks!

채택된 답변

Olawale Ikuyajolu
Olawale Ikuyajolu 2020년 5월 2일
편집: Olawale Ikuyajolu 2020년 5월 2일
Click here for the solution to similar problemClick here
  댓글 수: 1
Christo van Rensburg
Christo van Rensburg 2020년 5월 2일
I managed to solve it using the following code:
for j = 1:13
xVal = [Bx(j), Ax(j)];
yVal = [By(j), Ay(j)];
plot(xVal, yVal,'bo-'), grid on, hold on
xlim([-0.4 0.4]), ylim([-0.4 0.5])
end
This worked for two points and just created another for-loop for the other two points.
Thanks for the input guys!

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

추가 답변 (1개)

darova
darova 2020년 5월 2일
Try this solution
  댓글 수: 2
Christo van Rensburg
Christo van Rensburg 2020년 5월 2일
I tried something like this, but it's not quite what I'm after.
Christo van Rensburg
Christo van Rensburg 2020년 5월 2일
But thanks for your response, see my comment above.

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

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by