Maintain colors when ploting during a loop using hold on.
Hey, so imtrying to plot 5 lines where each line new value (5 new ‘y’ axes values) are being calculated iterativly using a loop.
I want to add every iteration the new 5 values while to the same exsiting 5 lines with their colors maintaind.
Thus keeping a constant color for 5 lines.
I have written something like this:
%%
figure(1);
hold on;
while (max(abs(dif)) > 1*10^-6)
if (mod(iteration_num,100) == 0)
plot(repmat(iteration_num,1,size),Xr(1:size));
end
iteration_num = iteration_num + 1;
Xr(r) = Xr(r) + k*((1/Xr(r)^alpha) – help);
end
%%
but every time I get inside the loop the plot uses 5 new colors for the new values while I want it to be consistent
Can anyone help me please?
ThanksHey, so imtrying to plot 5 lines where each line new value (5 new ‘y’ axes values) are being calculated iterativly using a loop.
I want to add every iteration the new 5 values while to the same exsiting 5 lines with their colors maintaind.
Thus keeping a constant color for 5 lines.
I have written something like this:
%%
figure(1);
hold on;
while (max(abs(dif)) > 1*10^-6)
if (mod(iteration_num,100) == 0)
plot(repmat(iteration_num,1,size),Xr(1:size));
end
iteration_num = iteration_num + 1;
Xr(r) = Xr(r) + k*((1/Xr(r)^alpha) – help);
end
%%
but every time I get inside the loop the plot uses 5 new colors for the new values while I want it to be consistent
Can anyone help me please?
Thanks Hey, so imtrying to plot 5 lines where each line new value (5 new ‘y’ axes values) are being calculated iterativly using a loop.
I want to add every iteration the new 5 values while to the same exsiting 5 lines with their colors maintaind.
Thus keeping a constant color for 5 lines.
I have written something like this:
%%
figure(1);
hold on;
while (max(abs(dif)) > 1*10^-6)
if (mod(iteration_num,100) == 0)
plot(repmat(iteration_num,1,size),Xr(1:size));
end
iteration_num = iteration_num + 1;
Xr(r) = Xr(r) + k*((1/Xr(r)^alpha) – help);
end
%%
but every time I get inside the loop the plot uses 5 new colors for the new values while I want it to be consistent
Can anyone help me please?
Thanks plot, iteration, color MATLAB Answers — New Questions