so I've created a simple planet simulation but because my plot is inside my for loop it will close and open (super fast) a new plot creating the sensation of flickering of my orbiting planets.
Here's a part of my for loop:
for step=1:n
%% Mercury
r_vekt_mercury=-p_mercury;
r_mercury=sqrt(x_mercury^2 + y_mercury^2); %Radius in AU
a_mercury=((G*m_0)/((r_mercury)^3))*r_vekt_mercury;
v_mercury=a_mercury*dt+v_mercury;
p_mercury=v_mercury*dt+p_mercury;
plot(psol(1),psol(2),'y.','markersize',60); %% Drawing ze sun
drawnow;
xlabel('AU');
ylabel('AU');
hold on
plot(p_mercury(1),p_mercury(2),'g.','markersize',25);
axis([-1 1 -1 1]); %AU
drawnow;
hold on
end
So as you see this for loop will create a new plot whenever it goes through the loop which creates the flickering.. Any solution?