how to plot points in a loop?
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
for x=1:10
a=2*x
b=3*x^2
plot(a,b)
end
But the figure cannot be plotted. What should i write for the codes?
1 comentario
Respuestas (1)
Stephen23
el 1 de Mzo. de 2018
Editada: Stephen23
el 1 de Mzo. de 2018
figure()
hold on
for ...
...
plot(a,b,'*')
end
But I would not recommend doing this: the simpler MATLAB solution would be to write vectorized code:
X = 1:10;
A = 2*X;
B = 3*X.^2;
plot(A,B,'-*')
1 comentario
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!