simple error on plotting

2 views (last 30 days)
Moj on 29 Oct 2015
Answered: Ingrid on 29 Oct 2015
Dear There, I got an unknown error on plotting so simple function. My function is:
function test
x = 0:pi/100:2*pi;
y = sin(x);
plot (x,y)
I am really confused why I get this unknown error:
Error using plot
Too many input arguments.
Error in test2 (line 4)
plot (x,y)
Thanks in advance

Answers (2)

Thorsten on 29 Oct 2015
Edited: Thorsten on 29 Oct 2015
It works for me. Try
and look which plot function you are actually using
which plot
BTW: linspace is a nice way to get some evenly spaced numbers
x = linspace(0, 2*pi); % default is 100 values
x = linspace(0, 2*pi, 200); % if you need more

Ingrid on 29 Oct 2015
this should work, are you sure that you have not redefined the plot function or used it as a variable name?

Community Treasure Hunt

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

Start Hunting!

Translated by