for idx = 1 hold on plot(idx,density(idx),"*") hold off pause(0.2) end showing incorrect
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Name your loop counter idx. For the first execution of the loop, idx should have a value of 1, and it should increase by 1 each consecutive iteration.
0 commentaires
Réponses (3)
KSSV
le 6 Juil 2022
density = density(:) ;
idx = (1:length(density))' ;
figure
plot(idx,density)
comet(idx,density)
0 commentaires
Yogesh
le 22 Avr 2025
density = density(:) ;
idx = (1:length(density))' ;
figure
plot(idx,density)
comet(idx,density
1 commentaire
Walter Roberson
le 22 Avr 2025
@Yogesh What difference is there between this answer and the one @KSSV posted nearly three years ago, https://www.mathworks.com/matlabcentral/answers/1754580-for-idx-1-hold-on-plot-idx-density-idx-hold-off-pause-0-2-end-showing-incorrect#answer_1001425
Voir également
Catégories
En savoir plus sur Numeric Types 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!