Too many input arguments while plotting

x=[1:10];
y=[10:20];
plot(x,y)
Error using plot
Too many input arguments. What's the mistake? My friends can plot it easily.

답변 (1개)

Star Strider
Star Strider 2020년 1월 6일

0 개 추천

Your friends most likely do not have a variable or user-created function called plot.
To find the one on your computer, run this line from a script or your Command Window:
which plot -all
That will tell you where it is so you can change its name to something that does not overshadow any MATLAB functions.

댓글 수: 1

While I agree with Star Strider based on the error that you provided, it should also be noted that both the x and y vectors must be the same length. Your example has an x-variable with size 1x10 and a y-variable with size 1x11. Try:
x = 1:10;
y = 11:20;
% or
x = 1:11;
y = 10:20;

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

카테고리

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

제품

릴리스

R2017b

태그

질문:

2020년 1월 6일

댓글:

2020년 1월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by