when i plot my figure doesnt show line

답변 (1개)

Star Strider
Star Strider 2021년 2월 27일

0 개 추천

Use a colon to create the vectors instead of a semicolon, and be sure the vectors are equal length:
x = 1:5;
y = 5:9;
plot(x,y)
alternatively, if you want to define ‘x’ and ‘y’ as 2-element vectors:
x = [1 5];
y = [6 9];
plot(x,y)
Both will work.

댓글 수: 6

Palvasha Turial
Palvasha Turial 2021년 2월 27일
now when i put semicolon nothing is showing up, no figure at all
Palvasha Turial
Palvasha Turial 2021년 2월 27일
it is the same as before, no line
Star Strider
Star Strider 2021년 2월 27일
Do not use the semicolon, except to end a statement (when you do not want to see the output) or unless you want to vertically concatenate rows of a matrix or vector.
See MATLAB Operators and Special Characters for more information on them.
Palvasha Turial
Palvasha Turial 2021년 2월 27일
even when i dont use it is still the same, no line on the figure
Palvasha Turial
Palvasha Turial 2021년 2월 27일
thank you all
Star Strider
Star Strider 2021년 2월 27일
Please use a version of the code I provided. Those will work.
The code you are attempting to run will not work and will likely throw errors.
Please see Getting Started or MATLAB Onramp (or preferably both of these) to understand how MATLAB works and how to write useful scripts.

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

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

제품

태그

질문:

2021년 2월 27일

댓글:

2021년 2월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by