how to plot a continuous graph in a loop
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sukhversha Luthra
le 29 Jan 2018
Commenté : Sukhversha Luthra
le 30 Nov 2021
for k=1:10;
x=5;
y=2*x-5*k*k*k
plot(k,y,'*');
hold on;
end
This program gives me a dotted graph.
however I wanted to get a regular(continuous) graph.
Please help me to find suitable command for that.
0 commentaires
Réponse acceptée
VBBV
le 28 Nov 2021
for k=1:10;
x=5;
y(k)=2*x-5*k*k*k;
plot(1:k,y(1:k),'*'); % use the loop indices to plot in a loop
end
you can use the loop indices to plot the graph inside the loop
Plus de réponses (1)
Morteza Hajitabar Firuzjaei
le 29 Jan 2018
you can make your vectors and plot your graph, like:
s = [1 1 1 1];
t = [2 4 5 3];
G = graph(s,t);
plot(G);
Mortrza Hajitabar Firuzjaei
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!