Hi, I am using MATLAB R2020a on a MacOS. I have specified the production of a graph within a 'for' loop but when I run the code, only the graph for the last run of the loop is displayed. I don't want to store all the vectors for each loop due to storage constraints and instead, the values in the vector are overwritten with each run of the loop.
Is there any way of displaying the graphs for all runs of the loop rather than just the last one?
Any suggestions would be much appreciated. Thanks in advance.
for currentcycle = 1:length(number_cycles)
if currentcycle > 1
current_expmean_v = (1 - 1/weight(currentcycle))*(previous_expmean_v) + (1/weight(currentcycle))*(values_v);
current_expmean_w = (1 - 1/weight(currentcycle))*(previous_expmean_w) + (1/weight(currentcycle))*(values_w);
plot(values_v, values_w, previous_expmean_v, previous_expmean_w);
title('2D phase space trajectory of current cycle and exponentially weighted trajectory of previous cycle');
previous_expmean_v = current_expmean_v;
previous_expmean_w = current_expmean_w;