필터 지우기
필터 지우기

Plotting with arrays, no graph displayed

조회 수: 1 (최근 30일)
Grace
Grace 2023년 3월 12일
댓글: Star Strider 2023년 3월 12일
x = [6000,9375];
y = 10;
plot(x,y,'red')
title('x by y')
xlabel('x')
ylabel('y')

채택된 답변

Star Strider
Star Strider 2023년 3월 12일
Plotting one point requres a marker, and plotting a line requires at least two vectors of the same size.
Two options, depending on the result you want —
x = [6000,9375];
y = 10;
figure
plot(x,y,'pr')
title('x by y')
xlabel('x')
ylabel('y')
x = [6000,9375];
y = 10*ones(size(x));
figure
plot(x,y,'red')
title('x by y')
xlabel('x')
ylabel('y')
And of course, you can plot both markers and lines of various kinds connecting them.
.
  댓글 수: 2
Grace
Grace 2023년 3월 12일
Thank for your answer, it is very helpful
Star Strider
Star Strider 2023년 3월 12일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by