hold on for idx = 1:10 plot(idx, density(idx),"*") drawnow xlim([0.0 10.0]) ylim([0.0 6.1]) hold on plot(1:idx, density(1:idx),"*") drawnow end Unrecognized function or variable 'density'.
Kshitij Singh answered .
2025-11-20
%Sample values
density = rand(1,10);
%Initialize an animated line with specifications as needed
h = animatedline('Marker', '*');
for idx = 1:10
%Add points to the line
addpoints(h, idx, density(idx))
%Update the figure
drawnow
end
