Plot figures in loop as superimposed top on top

4 visualizaciones (últimos 30 días)
JohnDylon
JohnDylon el 19 de Nov. de 2016
Comentada: Image Analyst el 20 de Nov. de 2016
Similar questions should have been asked however I couldn't get a solution.
Plot can superimpose these loop figures onto one another:
figure();
hold all
for i=1:2:11
y=i;
plot(x,y);
end
However, interestingly can't do the same here:
figure();
hold all
for i=1:2:11
y=x.^i;
plot(x,y);
end
What it does is plotting only the last figure. Any ideas why is this?

Respuestas (1)

KSSV
KSSV el 19 de Nov. de 2016
Editada: KSSV el 19 de Nov. de 2016
Used hold on after the plot inside loop.
  5 comentarios
KSSV
KSSV el 20 de Nov. de 2016
What is x?
Image Analyst
Image Analyst el 20 de Nov. de 2016
Is x a vector or scalar? What is/are its value(s) exactly? Give code to generate x.

Iniciar sesión para comentar.

Categorías

Más información sobre Title en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by