simple error on plotting

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)
end
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

Respuestas (2)

Thorsten
Thorsten el 29 de Oct. de 2015
Editada: Thorsten el 29 de Oct. de 2015

0 votos

It works for me. Try
clear
test2
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
or
x = linspace(0, 2*pi, 200); % if you need more
Ingrid
Ingrid el 29 de Oct. de 2015

0 votos

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

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

Moj
el 29 de Oct. de 2015

Respondida:

el 29 de Oct. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by