Plotting graph using M-file.

I want to plot graph of x Vs y. So when i do below steps its showing me error as Too many input arguments. So please let me know if you have any idea about this.
for i = 1:10:100
y=i+2;
t=y^2+4;
x(i) = (2*t-1);
k(i)=y+1;
end
plot (x(i),y(i))
I

4 comentarios

Walter Roberson
Walter Roberson el 1 de Mzo. de 2013
Which line is showing the problem?
Have you tried having no space after 'plot' ?
Shantanu K
Shantanu K el 1 de Mzo. de 2013
Editada: Shantanu K el 1 de Mzo. de 2013
yes i tried the same by removing space. its showing error in plot command... Error is * ??? Index exceeds matrix dimensions.
Error in ==> loop at 11
plot (x(i),y(i)) *__
I am doing this program in m-file so i want this to work in m-file Thanks for interest you shown in my problem....Thanks a lot!
kash
kash el 1 de Mzo. de 2013
the reason i sthe value x has more values than y ,y has single value,use plot inside loop
Shantanu K
Shantanu K el 1 de Mzo. de 2013
i tried by using plot inside loop command still its showing error.

Iniciar sesión para comentar.

 Respuesta aceptada

kash
kash el 1 de Mzo. de 2013
Editada: kash el 1 de Mzo. de 2013

0 votos

Try this
for i = 1:10:100
y=i+2;
t=y^2+4;
x(i) = (2*t-1);
k(i)=y+1;
bar(x,y)
end

1 comentario

Shantanu K
Shantanu K el 1 de Mzo. de 2013
Editada: Shantanu K el 1 de Mzo. de 2013
Thanks Kash for your answer but i want it in x Vs y format only....so if you know any other way please let me know. I am doing this program in m-file so i want this to work in mfile

Iniciar sesión para comentar.

Más respuestas (1)

ChristianW
ChristianW el 1 de Mzo. de 2013

0 votos

k = 0;
for m = 1:10:100
k = k+1;
y(k)=m+2;
t=y(k)^2+4;
x(k) = (2*t-1);
end
plot(x,y)

3 comentarios

Shantanu K
Shantanu K el 1 de Mzo. de 2013
Christian its still showing error....i closed MATLAB then started again but showing errors....
??? Error using ==> plot
Too many input arguments.
>>
ChristianW
ChristianW el 1 de Mzo. de 2013
Copy/Paste it to a new m-file, save and run it.
kash
kash el 1 de Mzo. de 2013
It works fine in my system,datas are plotted

Iniciar sesión para comentar.

Categorías

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

Etiquetas

Preguntada:

el 1 de Mzo. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by