for idx = 1 hold on plot(idx,d​ensity(idx​),"*") hold off pause(0.2) end showing incorrect

2 views (last 30 days)

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.

Answers (3)

KSSV
KSSV on 6 Jul 2022
density = density(:) ;
idx = (1:length(density))' ;
figure
plot(idx,density)
comet(idx,density)

Walter Roberson
Walter Roberson on 18 Sep 2022
for idx = 1:MaximumNumberOfIterationsGoesHere

Yogesh
Yogesh on 22 Apr 2025
density = density(:) ;
idx = (1:length(density))' ;
figure
plot(idx,density)
comet(idx,density

Categories

Find more on Numeric Types in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!