Continuous plot while plotting inside a loop in MATLAB -
i trying plot variables dynamically in matlab. have array (set of states) needs plotted time. tried plot(time,theta), theta 1*5 array. command, error saying theta should scalar because time scalar. tried using for-loop plot(time,theta(i)). problem data points @ discrete time intervals on plot. need continuous plot. wonder how can done.
you need use hold on
when plotting.
for example:
time = 1; theta = [1:100]; figure i=1:100 plot(time, theta(i),'r.') hold on %--> keeps previous data in plot time = time + 1; end
Comments
Post a Comment