for idx = 1 hold on plot(idx,density(idx),"*") hold off pause(0.2) end showing incorrect
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(3 个)
KSSV
2022-7-6
density = density(:) ;
idx = (1:length(density))' ;
figure
plot(idx,density)
comet(idx,density)
0 个评论
Yogesh
2025-4-22
density = density(:) ;
idx = (1:length(density))' ;
figure
plot(idx,density)
comet(idx,density
1 个评论
Walter Roberson
2025-4-22
@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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numeric Types 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!